Skip to content

Commit

Permalink
imp - bkp - Translate the settings CLI (really)
Browse files Browse the repository at this point in the history
---

In the settings CLI, we've forgot to query the translated display names
for each setting and key.

  - Backportable for 0.1.1.x

---

Type: imp
Breaking: False
Doc Required: False
Backport Required: True
Part: 1/1
  • Loading branch information
AptiviCEO committed Dec 4, 2024
1 parent 1486852 commit 9173284
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions public/Nitrocid/Misc/Interactives/SettingsCli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ public class SettingsCli : BaseInteractiveTui<(string, int)>, IInteractiveTui<(s
return entryNames;
var configs = config.SettingsEntries ??
throw new KernelException(KernelExceptionType.Config, Translate.DoTranslation("Can't get settings entries"));
var configNames = configs.Select((se, idx) => (se.Name, idx)).ToArray();
var configNames = configs.Select((se, idx) =>
(Translate.DoTranslation(!string.IsNullOrEmpty(se.DisplayAs) ? se.DisplayAs : se.Name), idx)
).ToArray();
var entry = configs[FirstPaneCurrentSelection - 1];
var keys = entry.Keys;
var finalkeyNames = keys.Select((key, idx) =>
{
object? currentValue = ConfigTools.GetValueFromEntry(key, config);
return ($"{key.Name} [{currentValue}]", idx);
return ($"{Translate.DoTranslation(key.Name)} [{currentValue}]", idx);
}).ToArray();
entryNames.Clear();
entryNames.AddRange(configNames);
Expand Down Expand Up @@ -119,7 +121,7 @@ public override string GetStatusFromItem((string, int) item)
return "";
var configs = config.SettingsEntries ??
throw new KernelException(KernelExceptionType.Config, Translate.DoTranslation("Can't get settings entries"));
string entryDesc = configs[entryIdx].Desc;
string entryDesc = Translate.DoTranslation(configs[entryIdx].Desc);
string status = $"E: {entryName} - {entryDesc}";
return status;
}
Expand Down

0 comments on commit 9173284

Please sign in to comment.