A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
UI: Settings gets a language choice, English / עברית, applied at once and kept (refs #1036) (#1058)
Beri8069edcab751
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 13fc3abbe..98a3263a1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -59,6 +59,11 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB- Event options in the GDD loop can move a city's housing condition: `city_effects` takes `field: condition` with achange from -1 to 1, the condition stays from 0 to 1, and a sensitive event may only lower it (R-EFX-004, R-EFX-005;refs #806). No event uses them yet.+- Settings: a language choice, English or עברית, under the quality choice (#1036). The Hebrew UI (#193) no longer needs+ `?lang=he` in the address: a press puts every screen in the other language at once, with no reload, over the same+ game and this turn's orders, and the choice is kept in `settings.txt` for the next visit. `?lang=` in the address+ (or `-lang` on the desktop) still decides for that visit. A line under the choice says the event cards are still in+ English only (#55).- Settings: a graphics quality choice, Automatic, High or Low (refs #40, second slice; owner decision of 18 Oct 2026).Automatic is what the game did before: the tier the device gets, and on the web the frame-time fallback steps downwhen frames are slow. High is the PC tier at render scale 1.0 and Low the Mobile tier at 0.8, both fixed, so thediff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.csindex 45ca8c8fd..91c65202a 100644--- a/unity/Assets/Scripts/UI/GameRoot.cs+++ b/unity/Assets/Scripts/UI/GameRoot.cs@@ -62,12 +62,21 @@ namespace Statecraft.Game.UIList<(string, int, int, DateTime)>? drawn;/// <summary>The designated sites on the map (#381), made on first use beside the placements; and their states as drawn.</summary>SiteLayer? siteLayer; List<string>? drawnSites;+ /// <summary>Whether the last Begin was a smoke run: the language switch then leaves the UI as it is, so the golden-seed+ /// game never gets the autosave and New Game a normal Begin gives (SwitchLanguage).</summary>+ bool smokeRun;public SimBridge? Bridge { get; private set; }/// <summary>Where the autosave lives; null (the default) = SaveStore.ForPlatform(). Tests set a temporary folder.</summary>internal SaveStore? Store { get; set; }- /// <summary>The UI's language; null (the default) = UiLanguage.Requested(). Tests set it.</summary>+ /// <summary>The UI's language; null (the default) = UiLanguage.AtStart (a flag, else the choice kept in Settings).+ /// Tests set it, and so does Settings' language switch.</summary>internal string? Language { get; set; }+ /// <summary>Where the Settings options are kept; null (the default) = SettingsStore.ForPlatform() in Play mode and+ /// players, none outside Play mode (EditMode tests: the developer's own settings must not leak into a test). Tests set+ /// a temporary folder.</summary>+ internal SettingsStore? Settings { get; set; }+ SettingsStore? SettingsFile() => Settings ?? (Application.isPlaying ? SettingsStore.ForPlatform() : null);public void Configure(GameBoot boot, UIDocument document, TextAsset strings, TextAsset stringsHe, PortraitCatalog portraits,MapScene map, PlacementLayer placements, MapPointer pointer, CameraController cameraController)@@ -127,8 +136,8 @@ namespace Statecraft.Game.UIline.languageDirection = !hebrew ? LanguageDirection.Inherit : UiDirection.RightToLeft(words) ? LanguageDirection.RTL : LanguageDirection.LTR;}- /// <summary>The strings of the UI's language (UiLanguage): strings.he.yaml when Hebrew is asked for, else English.</summary>- UiText Strings() => (Language ?? UiLanguage.Requested()) == UiLanguage.Hebrew+ /// <summary>The strings of the UI's language (UiLanguage): strings.he.yaml when Hebrew is asked for or chosen, else English.</summary>+ UiText Strings() => (Language ?? UiLanguage.AtStart(SettingsFile()?.Read(SettingsPresenter.LanguageKey))) == UiLanguage.Hebrew? UiText.Parse(stringsHe.text, "strings.he.yaml") : UiText.Parse(strings.text);void OnDisable()@@ -169,8 +178,10 @@ namespace Statecraft.Game.UIpublic void Begin(GameInputs inputs) => Begin(inputs, SmokeTurns(), Application.isPlaying && !StartScreenPresenter.Skipped());/// <summary>Starts (or restarts) the game over the built map. <paramref name="smoke"/> > 0 plays that many turns;- /// <paramref name="startScreen"/> shows the start screen first (never in a smoke run, which has no New Game).</summary>- internal void Begin(GameInputs inputs, int smoke, bool startScreen = false)+ /// <paramref name="startScreen"/> shows the start screen first (never in a smoke run, which has no New Game).+ /// <paramref name="keep"/> (Settings' language switch) goes on with that bridge's game and its queued orders instead+ /// of loading the autosave.</summary>+ internal void Begin(GameInputs inputs, int smoke, bool startScreen = false, SimBridge? keep = null){if (inputs == null) throw new ArgumentNullException(nameof(inputs));foreach (var (value, field) in new (UnityEngine.Object?, string)[] { (document, nameof(document)), (strings, nameof(strings)), (stringsHe, nameof(stringsHe)),@@ -178,17 +189,19 @@ namespace Statecraft.Game.UIif (value == null) throw new InvalidOperationException($"GameRoot: {field} is not assigned (run MapCapture.MakeScene)");if (map.Terrain == null) throw new InvalidOperationException("GameRoot: the map is not built (GameBoot builds it before Ready)");Shutdown();+ smokeRun = smoke > 0;var text = Strings();var store = Store ?? SaveStore.ForPlatform();var notes = new List<string>();// A smoke run is reproducible: a fresh game with the golden seed, never the player's autosave.- bool resumed;- var session = smoke > 0+ bool resumed = true;+ var session = keep?.Session ?? (smoke > 0? GameStart.Begin(inputs.Content, store, () => GoldenRun.Seed, notes, text, out resumed, fresh: true)- : GameStart.Begin(inputs.Content, store, GameStart.NewSeed, notes, text, out resumed);+ : GameStart.Begin(inputs.Content, store, GameStart.NewSeed, notes, text, out resumed));DiagLog.BootPhase($"session started (turn {session.State.Turn}, replayed)");var bridge = Bridge = new SimBridge(session, text);+ if (keep != null) foreach (var order in keep.Queued) bridge.Queue(order); // in their order: each was within the attention leftvar root = document.rootVisualElement;bool hebrew = text["ui.lang"] == UiLanguage.Hebrew;// Hebrew: the Hebrew face, the advanced text generator and the mirrored rows (.lang-he); each text's paragraph@@ -233,7 +246,8 @@ namespace Statecraft.Game.UIOwn(new HowToPlayPresenter(root, text));// Presentation only (#40): never the sim or the save. Outside Play mode (EditMode tests) no file: the developer's// own settings must not leak into a test. Each Begin (New Game too) reads the file again.- Own(new SettingsPresenter(root, text, Application.isPlaying ? SettingsStore.ForPlatform() : null));+ // The language switch (#1036) builds every screen again in the new language over this game (SwitchLanguage).+ Own(new SettingsPresenter(root, text, SettingsFile(), language => SwitchLanguage(inputs, language)));Own(new CabinetPresenter(root, bridge, text, portraits));// After End Turn, what changed in the top bar and the sim's causes (#1037); under an outcome clip, which plays first.report = Own(new TurnReportPresenter(root, bridge, text, nav!));@@ -398,6 +412,18 @@ namespace Statecraft.Game.UIelse if (Application.isPlaying && VisualShots.Requested()) StartCoroutine(VisualShots.Run(camRig, map.Frame, Debug.Log));}+ /// <summary>Settings' language switch (#1036): every screen again in <paramref name="language"/> at once, no reload,+ /// over the same game with this turn's orders (Begin's keep), and Settings open again with the focus on the choice+ /// just made (for a mouse press too: the rebuilt UI has no focus to keep). Not in a smoke run (smokeRun).</summary>+ void SwitchLanguage(GameInputs inputs, string language)+ {+ if (Bridge == null || smokeRun) return;+ Language = language;+ Begin(inputs, 0, keep: Bridge);+ nav?.Open("settings");+ document.rootVisualElement.Q<Button>("settings-language-" + language)?.Focus();+ }+/// <summary>The 1948 localities in a hex (by the hex their point lies in, as the map picks hexes), for the info panel.</summary>internal static Func<int, int, IReadOnlyList<Statecraft.Game.Map.Kits.Localities.Place>> LocalitiesAt(MapScene map){diff --git a/unity/Assets/Scripts/UI/SettingsPresenter.cs b/unity/Assets/Scripts/UI/SettingsPresenter.csindex 3b9da76bc..efe57365e 100644--- a/unity/Assets/Scripts/UI/SettingsPresenter.cs+++ b/unity/Assets/Scripts/UI/SettingsPresenter.cs@@ -8,21 +8,25 @@ using UnityEngine.UIElements;namespace Statecraft.Game.UI{/// <summary>The Settings screen (#40), opened from the left column's gear like the other screens (ScreenNav). Its options:- /// the graphics quality (GraphicsQuality: Auto / High / Low) and the tilt-shift blur. The blur option turns it off and- /// on: applied at once (TiltShift.Enabled, what the "tiltshift" toggle sets) and kept in the SettingsStore, so it- /// holds after a reload. A stored "off" only ever turns the blur off, so ?notiltshift still boots without it. The+ /// the graphics quality (GraphicsQuality: Auto / High / Low), the UI's language (#1036) and the tilt-shift blur. The+ /// blur option turns it off and on: applied at once (TiltShift.Enabled, what the "tiltshift" toggle sets) and kept in+ /// the SettingsStore, so it holds after a reload. A stored "off" only ever turns the blur off, so ?notiltshift still boots without it. The/// button says what is set ("On" / "Off"), not only a colour: the player's choice (Enabled), not the web tier's/// automatic last fallback step (TiltShift.FallbackOff), which it never changes.</summary>public sealed class SettingsPresenter : IDisposable{- public const string TiltShiftKey = "tiltshift", QualityKey = "quality", SelectedClass = "settings-choice-selected";+ public const string TiltShiftKey = "tiltshift", QualityKey = "quality", LanguageKey = "lang", SelectedClass = "settings-choice-selected";readonly SettingsStore? store; readonly UiText text; readonly VisualElement screen; readonly Button tiltShift;readonly (Button button, GraphicsQuality.Choice choice, Action pick)[] quality;+ readonly (Button button, string language, Action pick)[] languages;+ readonly Action<string>? switchLanguage;/// <param name="store">Where the choice is kept; null keeps nothing (the option still works until the page closes).</param>- public SettingsPresenter(VisualElement root, UiText text, SettingsStore? store)+ /// <param name="switchLanguage">Puts the UI in the language pressed (GameRoot builds the screens again); null changes+ /// nothing but the stored choice, read at the next start.</param>+ public SettingsPresenter(VisualElement root, UiText text, SettingsStore? store, Action<string>? switchLanguage = null){- this.store = store; this.text = text;+ this.store = store; this.text = text; this.switchLanguage = switchLanguage;screen = root.Q<VisualElement>("screen-settings");screen.Q<Label>("settings-screen-title").text = text["settings.title"];screen.Q<Label>("settings-tiltshift-label").text = text["settings.tiltshift"];@@ -45,6 +49,18 @@ namespace Statecraft.Game.UIvar start = GraphicsQuality.AtStart(store?.Read(QualityKey), Application.absoluteURL, Environment.GetCommandLineArgs(),Application.platform == RuntimePlatform.WebGLPlayer);if (start != GraphicsQuality.Current) GraphicsQuality.Apply(start);+ // The UI's language (#1036): each button names its language in that language, so a player who cannot read the+ // UI's one still finds their own; the one in use is marked. UiLanguage.AtStart reads the stored choice.+ screen.Q<Label>("settings-language-label").text = text["settings.language"];+ screen.Q<Label>("settings-language-note").text = text["settings.language.note"];+ languages = Array.ConvertAll(new[] { (UiLanguage.English, "English"), (UiLanguage.Hebrew, "עברית") }, l =>+ {+ var b = screen.Q<Button>("settings-language-" + l.Item1);+ b.text = l.Item2;+ Action pick = () => PickLanguage(l.Item1);+ b.clicked += pick;+ return (b, l.Item1, pick);+ });ScreenNav.OnOpened(screen, Show); // a dev toggle may have changed it while the screen was shutShow();}@@ -53,6 +69,7 @@ namespace Statecraft.Game.UI{tiltShift.clicked -= Flip;foreach (var (b, _, pick) in quality) b.clicked -= pick;+ foreach (var (b, _, pick) in languages) b.clicked -= pick;if (screen.userData is Action) screen.userData = null;}@@ -79,10 +96,23 @@ namespace Statecraft.Game.UI}}+ /// <summary>Keeps the choice first: the switch disposes this presenter with the rest of the UI.</summary>+ void PickLanguage(string language)+ {+ if (language == text["ui.lang"]) return;+ try { store?.Write(LanguageKey, language); }+ catch (Exception e) when (e is IOException || e is UnauthorizedAccessException)+ {+ Debug.LogWarning($"Settings: could not keep the language choice ({e.Message}); it holds until the page is closed");+ }+ switchLanguage?.Invoke(language);+ }+void Show(){tiltShift.text = text[TiltShift.Enabled ? "settings.on" : "settings.off"];foreach (var (b, c, _) in quality) b.EnableInClassList(SelectedClass, c == GraphicsQuality.Current);+ foreach (var (b, l, _) in languages) b.EnableInClassList(SelectedClass, l == text["ui.lang"]);}}}diff --git a/unity/Assets/Scripts/UI/UiLanguage.cs b/unity/Assets/Scripts/UI/UiLanguage.csindex cda3c8441..c88a149ed 100644--- a/unity/Assets/Scripts/UI/UiLanguage.cs+++ b/unity/Assets/Scripts/UI/UiLanguage.cs@@ -5,9 +5,9 @@ using UnityEngine;namespace Statecraft.Game.UI{- /// <summary>The UI's language (#193): English unless Hebrew is asked for by hand, "?lang=he" in the page URL on WebGL or- /// "-lang he" on the desktop command line. There is no control in the game yet: the content text (events, names) is- /// English only until #55, so the Hebrew UI is a preview. Any other value, or a bare flag, is English.</summary>+ /// <summary>The UI's language (#193): English unless Hebrew is asked for, "?lang=he" in the page URL on WebGL or+ /// "-lang he" on the desktop command line, or chosen in Settings (#1036, kept in settings.txt). The content text+ /// (events, names) is English only until #55. Any other value, or a bare flag, is English.</summary>public static class UiLanguage{public const string Flag = "lang";@@ -19,6 +19,17 @@ namespace Statecraft.Game.UI// A whole query parameter with a whole value (UrlFlags' rule): "?lang=hex" and "?slang=he" are not the flag.static readonly Regex HebrewQuery = new Regex(@"[?&]" + Flag + "=" + Hebrew + @"(?=&|#|$)", RegexOptions.CultureInvariant);+ // The flag with any value, or none: the address names a language for this visit.+ static readonly Regex AnyQuery = new Regex(@"[?&]" + Flag + @"(?:=[^&#]*)?(?=&|#|$)", RegexOptions.CultureInvariant);++ /// <summary>The language at start (#1036): a flag in the address or on the command line (the store page's "?lang=he"+ /// link) holds for that visit, over the choice <paramref name="stored"/> in Settings; with neither, English.</summary>+ public static string AtStart(string? stored, string? url, string[] args, bool webgl)+ {+ bool flag = webgl ? AnyQuery.IsMatch(url ?? "") : Array.IndexOf(args, "-" + Flag) >= 0;+ return flag ? Requested(url, args, webgl) : stored == Hebrew ? Hebrew : English;+ }+public static string Requested(string? url, string[] args, bool webgl){if (webgl) return HebrewQuery.IsMatch(url ?? "") ? Hebrew : English;@@ -34,7 +45,7 @@ namespace Statecraft.Game.UIreturn false;}- public static string Requested() =>- Requested(Application.absoluteURL, Environment.GetCommandLineArgs(), Application.platform == RuntimePlatform.WebGLPlayer);+ public static string AtStart(string? stored) =>+ AtStart(stored, Application.absoluteURL, Environment.GetCommandLineArgs(), Application.platform == RuntimePlatform.WebGLPlayer);}}diff --git a/unity/Assets/Tests/EditMode/HebrewUiTests.cs b/unity/Assets/Tests/EditMode/HebrewUiTests.csindex 1121d0748..82ed92f9d 100644--- a/unity/Assets/Tests/EditMode/HebrewUiTests.cs+++ b/unity/Assets/Tests/EditMode/HebrewUiTests.cs@@ -102,6 +102,64 @@ public class HebrewUiTestsTheDeclarationStaysRightToLeft("an English restart");}+ /// <summary>The language switch in Settings (#1036): a press rebuilds the UI in the other language at once, over the same+ /// game (this turn's orders kept), with Settings still open on the new choice; the choice is kept in settings.txt, so+ /// the next start (Language unset, as a reload leaves it) comes up in it.</summary>+ [Test]+ public void TheLanguageSwitchInSettingsChangesTheUiAtOnceAndIsKept()+ {+ EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);+ Object.FindFirstObjectByType<MapScene>().Build(Inputs.Map);+ var game = Object.FindFirstObjectByType<GameRoot>();+ game.Store = new SaveStore(saveDir);+ var settings = new SettingsStore(Path.Combine(saveDir, "settings"));+ game.Settings = settings;+ game.Begin(Inputs, 0); // no file and no flag: English+ Assert.IsFalse(Ui.Q("root").ClassListContains(UiLanguage.HebrewClass));+ Assert.IsTrue(Ui.Q<Button>("settings-language-en").ClassListContains(SettingsPresenter.SelectedClass), "English is marked");+ Assert.AreEqual("English", Ui.Q<Button>("settings-language-en").text);+ Assert.AreEqual("עברית", Ui.Q<Button>("settings-language-he").text, "each language is named in itself");+ var session = game.Bridge!.Session;+ Assert.IsNull(game.Bridge.Queue(new Statecraft.Sim.SetMobilization(1.0)));++ UiTestKit.Press(Ui.Q<Button>("settings-language-he"));+ Assert.IsTrue(Ui.Q("root").ClassListContains(UiLanguage.HebrewClass), "Hebrew at once, no reload");+ Assert.AreEqual(He.Format("hud.turn", game.Bridge!.State.Turn), Ui.Q<Label>("turn").text);+ Assert.AreSame(session, game.Bridge.Session, "the same game goes on");+ Assert.AreEqual(1, game.Bridge.Queued.Count, "this turn's order is kept");+ Assert.IsTrue(ScreenNav.IsOpen(Ui.Q("screen-settings")), "Settings stays open");+ Assert.IsTrue(Ui.Q<Button>("settings-language-he").ClassListContains(SettingsPresenter.SelectedClass), "Hebrew is marked");+ Assert.IsFalse(Ui.Q<Button>("settings-language-en").ClassListContains(SettingsPresenter.SelectedClass));+ Assert.AreEqual(UiLanguage.Hebrew, settings.Read(SettingsPresenter.LanguageKey), "kept in settings.txt");++ game.Language = null; // a reload: only the file remains+ game.Begin(Inputs, 0);+ Assert.IsTrue(Ui.Q("root").ClassListContains(UiLanguage.HebrewClass), "Hebrew after a reload");++ UiTestKit.Press(Ui.Q<Button>("settings-language-en"));+ Assert.IsFalse(Ui.Q("root").ClassListContains(UiLanguage.HebrewClass), "and English again at once");+ Assert.AreEqual(En.Format("hud.turn", game.Bridge!.State.Turn), Ui.Q<Label>("turn").text);+ Assert.AreEqual(UiLanguage.English, settings.Read(SettingsPresenter.LanguageKey));+ }++ /// <summary>A language named in the address or on the command line (the store page's "?lang=he" link) holds for that+ /// visit over the stored choice; without one the stored choice holds; with neither, English.</summary>+ [Test]+ public void AFlagWinsOverTheStoredLanguage()+ {+ const string page = "http://localhost:8000/index.html";+ var none = new string[0];+ Assert.AreEqual(UiLanguage.English, UiLanguage.AtStart(null, page, none, webgl: true));+ Assert.AreEqual(UiLanguage.Hebrew, UiLanguage.AtStart(UiLanguage.Hebrew, page, none, webgl: true));+ Assert.AreEqual(UiLanguage.Hebrew, UiLanguage.AtStart(UiLanguage.Hebrew, page + "?golden", none, webgl: true));+ Assert.AreEqual(UiLanguage.Hebrew, UiLanguage.AtStart(UiLanguage.English, page + "?lang=he", none, webgl: true));+ Assert.AreEqual(UiLanguage.English, UiLanguage.AtStart(UiLanguage.Hebrew, page + "?lang=en", none, webgl: true));+ Assert.AreEqual(UiLanguage.English, UiLanguage.AtStart("fr", page, none, webgl: true), "a value the game does not know");+ Assert.AreEqual(UiLanguage.Hebrew, UiLanguage.AtStart(UiLanguage.Hebrew, null, none, webgl: false));+ Assert.AreEqual(UiLanguage.Hebrew, UiLanguage.AtStart(null, null, new[] { "-lang", "he" }, webgl: false));+ Assert.AreEqual(UiLanguage.English, UiLanguage.AtStart(UiLanguage.Hebrew, null, new[] { "-lang", "en" }, webgl: false));+ }+static void TheDeclarationStaysRightToLeft(string after){var lines = Ui.Query<TextElement>(className: "start-he").ToList();@@ -227,6 +285,7 @@ public class HebrewUiTests("nav-settings", "hud.nav.settings"), ("settings-screen-title", "settings.title"), ("settings-tiltshift-label", "settings.tiltshift"),("settings-quality-label", "settings.quality"), ("settings-quality-auto", "settings.quality.auto"),("settings-quality-high", "settings.quality.high"), ("settings-quality-low", "settings.quality.low"),+ ("settings-language-label", "settings.language"), ("settings-language-note", "settings.language.note"),("start-source", "start.source"), ("start-recording-credit", "start.recording_credit"),("start-continue", "start.continue"), ("start-new-game", "start.new_game"),};@@ -543,12 +602,14 @@ public class HebrewUiTestsl.AddToClassList(c);root.Add(l);}- // The start screen's Hebrew lines are Hebrew in both languages (the Declaration's own text).- var texts = root.Query<TextElement>().ToList().Where(e => !e.ClassListContains("start-he")).ToList();+ // The start screen's Hebrew lines are Hebrew in both languages (the Declaration's own text), and so is Settings'+ // button that names Hebrew in Hebrew (#1036).+ var texts = root.Query<TextElement>().ToList().Where(e => !e.ClassListContains("start-he") && e.name != "settings-language-he").ToList();Assert.Greater(texts.Count, 30, "Game.uxml's labels and buttons");for (int i = 0; i < 3; i++) yield return null; // resolved styles need a style passforeach (var e in texts)Assert.AreNotSame(hebrew, FontOf(e), $"English: '{e.name}' ({string.Join(" ", e.GetClasses())})");+ Assert.AreSame(hebrew, FontOf(root.Q<TextElement>("settings-language-he")), "English: 'עברית' has the Hebrew face");root.AddToClassList(UiLanguage.HebrewClass);for (int i = 0; i < 3; i++) yield return null;foreach (var e in texts)diff --git a/unity/Assets/Tests/EditMode/SettingsScreenTests.cs b/unity/Assets/Tests/EditMode/SettingsScreenTests.csindex 195483627..ddfcb87e8 100644--- a/unity/Assets/Tests/EditMode/SettingsScreenTests.cs+++ b/unity/Assets/Tests/EditMode/SettingsScreenTests.cs@@ -318,7 +318,8 @@ public class SettingsScreenTestsAssert.IsTrue(Inside(screen, root.worldBound), $"{at}: the screen {screen} leaves the window {root.worldBound}");Assert.GreaterOrEqual(screen.yMin, root.Q("top-bar").worldBound.yMax - 0.5f, at + ": the screen starts below the top bar");foreach (var name in new[] { "settings-screen-title", "settings-tiltshift-label", "settings-tiltshift",- "settings-quality-label", "settings-quality-auto", "settings-quality-high", "settings-quality-low" })+ "settings-quality-label", "settings-quality-auto", "settings-quality-high", "settings-quality-low",+ "settings-language-label", "settings-language-en", "settings-language-he", "settings-language-note" }){var e = root.Q<TextElement>(name);Assert.IsFalse(string.IsNullOrWhiteSpace(e.text), $"{at}: {name} has its text");diff --git a/unity/Assets/UI/Game.uxml b/unity/Assets/UI/Game.uxmlindex a8385d862..da3010737 100644--- a/unity/Assets/UI/Game.uxml+++ b/unity/Assets/UI/Game.uxml@@ -327,6 +327,15 @@<ui:Button name="settings-quality-low" text="Low" class="settings-switch" /></ui:VisualElement></ui:VisualElement>+ <!-- The UI's language (#1036): SettingsPresenter names each language in itself; the one in use carries .settings-choice-selected. -->+ <ui:VisualElement class="row settings-row">+ <ui:Label name="settings-language-label" text="Language" class="settings-name" />+ <ui:VisualElement class="row settings-choices">+ <ui:Button name="settings-language-en" class="settings-switch" />+ <ui:Button name="settings-language-he" class="settings-switch" />+ </ui:VisualElement>+ </ui:VisualElement>+ <ui:Label name="settings-language-note" text="Event cards are English only for now." class="settings-note muted" /><Statecraft.Game.UI.UiFrame /></ui:VisualElement><!-- The turn report (#1037, TurnReportPresenter): after End Turn, each top-bar number that changed and the sim's causes.diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.ussindex 37217b09c..0bf5935ee 100644--- a/unity/Assets/UI/Statecraft.uss+++ b/unity/Assets/UI/Statecraft.uss@@ -412,6 +412,13 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);/* The regular cut's thin strokes fade on the gold. Only as specific as ".lang-he Button", which comes later and keepsthe Hebrew face in Hebrew. */Button.settings-choice-selected { -unity-font-definition: url("project://database/Assets/UI/Fonts/EBGaramond-SemiBold.ttf"); }+/* The language choice (#1036): "עברית" is in the Hebrew face in the English UI too (EB Garamond has no Hebrew), by id so+ that it beats the selected button's face above. The note under the row wraps. */+#settings-language-he {+ -unity-font-definition: url("project://database/Assets/UI/Fonts/FrankRuhlLibre/FrankRuhlLibre-Medium.ttf");+ -unity-text-generator: advanced;+}+.settings-note { white-space: normal; margin-top: 4px; }/* The toast sits in the map's free top-left corner, above the info panel: opaque, and never over an open screen's title orthe minimap column (B7). */diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yamlindex 34e8fced4..20e0bce90 100644--- a/unity/Assets/UI/strings.en.yaml+++ b/unity/Assets/UI/strings.en.yaml@@ -69,6 +69,10 @@ settings.quality: "Quality"settings.quality.auto: "Automatic"settings.quality.high: "High"settings.quality.low: "Low"+# The language choice (#1036). The two languages are named on their buttons in themselves ("English", "עברית"), set in+# SettingsPresenter, not here. The note says what is not translated yet (#55).+settings.language: "Language"+settings.language.note: "Event cards are English only for now."event.draft: "DRAFT"start.source: "From the Declaration of the Establishment of the State of Israel (Official Gazette No. 1, 14 May 1948) and its official English translation. Painting: AI-generated."start.recording_credit: "Recording: Ralph Hellinger, Israel State Archives"diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yamlindex c76ca0033..88cb78317 100644--- a/unity/Assets/UI/strings.he.yaml+++ b/unity/Assets/UI/strings.he.yaml@@ -63,6 +63,10 @@ settings.quality: "איכות גרפית"settings.quality.auto: "אוטומטית"settings.quality.high: "גבוהה"settings.quality.low: "נמוכה"+# The language choice (#1036); the languages' names are on their buttons, in themselves (SettingsPresenter). The note+# says that the event cards are not translated yet (#55). For the native reviewer (#564).+settings.language: "שפה"+settings.language.note: "כרטיסי האירועים באנגלית בלבד בינתיים."event.draft: "טיוטה"start.source: "מתוך ההכרזה על הקמת מדינת ישראל (עיתון רשמי מס׳ 1, 14 במאי 1948) ותרגומה הרשמי לאנגלית. הציור נוצר בבינה מלאכותית."# The recordist's name as the Israel State Archives spells it in its own description of item