Stop printing a default for text-valued setting keys

An absent lang key does not mean English, it means follow the system language.
This commit is contained in:
maj00r
2026-09-04 21:36:13 +02:00
parent 4aec689059
commit bce008f0ed
2 changed files with 18 additions and 2 deletions

View File

@@ -18,6 +18,16 @@ public class SettingKeyCatalogTests
Assert.Equal("vsync = false", SettingKeyCatalog.Annotate("vsync"));
}
[Fact]
public void A_text_valued_key_is_shown_without_a_default()
{
// An absent lang means "follow the operating system", not "English", and an
// absent exe path means "go and find the binary" - neither has a default
// worth printing.
Assert.Equal("lang", SettingKeyCatalog.Annotate("lang"));
Assert.Equal("starter.exe.path", SettingKeyCatalog.Annotate("starter.exe.path"));
}
[Fact]
public void A_composite_or_unknown_key_is_shown_as_written()
{

View File

@@ -16,6 +16,12 @@ public readonly record struct SettingKeyInfo(string Key, string? Default, string
/// literals that method defaults and clamps with - so the settings screen can
/// state a fact about each key rather than a description of it. If a default or
/// a clamp changes in the serializer, it changes here too.
///
/// Text-valued keys carry no default. The literal the serializer passes to
/// GetString is the last step of a chain, not the value the simulator assumes:
/// an absent <c>lang</c> means the starter follows the operating system, and an
/// absent <c>starter.exe.path</c> means it goes looking for the binary itself.
/// Printing "lang = en" beside the language picker would state something untrue.
/// </remarks>
public static class SettingKeyCatalog
{
@@ -61,7 +67,7 @@ public static class SettingKeyCatalog
["height"] = new("height", "720", null),
["inactivepause"] = new("inactivepause", "true", null),
["input.gamepad"] = new("input.gamepad", "true", null),
["lang"] = new("lang", "en", null),
["lang"] = new("lang", null, null),
["livetraction"] = new("livetraction", "true", null),
["maxcabtexturesize"] = new("maxcabtexturesize", "4096", null),
["maxtexturesize"] = new("maxtexturesize", "4096", null),
@@ -87,7 +93,7 @@ public static class SettingKeyCatalog
["starter.bufferscale"] = new("starter.bufferscale", "100", "50-200"),
["starter.drivableonly"] = new("starter.drivableonly", "true", null),
["starter.exe.auto"] = new("starter.exe.auto", "true", null),
["starter.exe.path"] = new("starter.exe.path", "eu07.exe", null),
["starter.exe.path"] = new("starter.exe.path", null, null),
["starter.expandtree"] = new("starter.expandtree", "false", null),
["starter.hide.archivalvehicles"] = new("starter.hide.archivalvehicles", "true", null),
["starter.ignoreirrelevant"] = new("starter.ignoreirrelevant", "false", null),