Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

UI: the Budget rows, vote line and event card's office line in Hebrew (refs #900) (#986)

Eyal Golan4a8a81bb5057
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a4bf2a8a5..3c24fe27f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,8 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB
"ראש הממשלה"; Beri's wording as a native speaker). A card with no portrait shows the first name's initial and the surname
("י. ידין"). A row with no Hebrew form yet keeps its English name (today only the Minister responsible for rationing).
English is unchanged.
+- Under `?lang=he` the Budget rows and vote line, and the event card's office line, use the content's Hebrew office,
+ holder and legislature names; a missing Hebrew name keeps its English form (refs #900, #558).
## [0.1.0] - 2026-10-18
diff --git a/unity/Assets/Scripts/UI/BudgetPresenter.cs b/unity/Assets/Scripts/UI/BudgetPresenter.cs
index 53b9e26f6..bc0d597a1 100644
--- a/unity/Assets/Scripts/UI/BudgetPresenter.cs
+++ b/unity/Assets/Scripts/UI/BudgetPresenter.cs
@@ -139,9 +139,10 @@ namespace Statecraft.Game.UI
var o = c.Offices.First(x => x.Id == (Offices.BudgetOwner(c, office, s.Date) ?? office));
var share = draft.TryGetValue(office, out var v) ? v : 0;
// A budget line can run before its ministry exists (Education from 10 March 1949): say so, not "vacant".
+ var holder = Cabinet.Holder(c, s, o.Id);
var who = o.From.HasValue && s.Date < o.From.Value ? text.Format("budget.not_established", Statecraft.Game.Map.Control1948.DateText(o.From.Value, k => text[k])) // PlayerText.Date is always English (#701)
- : Cabinet.Holder(c, s, o.Id)?.Name ?? text["budget.vacant"];
- ((Label)row[0]).text = text.Format("budget.office", o.Title, who);
+ : holder == null ? text["budget.vacant"] : ContentNames.Of(text, holder);
+ ((Label)row[0]).text = text.Format("budget.office", ContentNames.Of(text, o, holder), who);
((Label)row[2]).text = text.Format("budget.share", PlayerText.Percent(share));
((Label)row[4]).text = text.Format("budget.factor", PlayerText.Percent(EffectsSystem.BudgetFactor(draft, office)));
}
@@ -149,8 +150,8 @@ namespace Statecraft.Game.UI
var (seats, size) = PoliticsSystem.CoalitionSeats(c, s.Date);
// eras.yaml systems.legislature: an assembly's vote is held but does not bind (#58)
var advisory = c.SystemsAt(s.Date).Legislature == EraSystems.Assembly;
- screen.Q<Label>("budget-vote").text = leg == null ? "" : !leg.BudgetApproval ? text.Format("budget.no_vote", leg.Body)
- : text.Format(advisory ? "budget.vote_advisory" : "budget.vote_needed", leg.Body, seats, size, CabinetPresenter.SeatUnit(text, leg));
+ screen.Q<Label>("budget-vote").text = leg == null ? "" : !leg.BudgetApproval ? text.Format("budget.no_vote", ContentNames.Of(text, leg))
+ : text.Format(advisory ? "budget.vote_advisory" : "budget.vote_needed", ContentNames.Of(text, leg), seats, size, CabinetPresenter.SeatUnit(text, leg));
screen.Q<Label>("budget-money").text = text.Format("budget.money", PlayerText.Money(c, "treasury", s.Treasury), PlayerText.Money(c, "debt", s.Debt), PlayerText.Money(c, "fx_reserves", s.FxReserves));
var flows = EconomySystem.Flows(c, s, 1.0); // the sim's own arithmetic, for a year
screen.Q<Label>("budget-flow").text = text.Format("budget.flow", PlayerText.Money(c, "treasury", flows.Tax), PlayerText.Money(c, "treasury", flows.Spending), PlayerText.Money(c, "treasury", flows.Mobilization));
diff --git a/unity/Assets/Scripts/UI/EventCardPresenter.cs b/unity/Assets/Scripts/UI/EventCardPresenter.cs
index a5a2426c9..6f8fd8ead 100644
--- a/unity/Assets/Scripts/UI/EventCardPresenter.cs
+++ b/unity/Assets/Scripts/UI/EventCardPresenter.cs
@@ -217,7 +217,8 @@ namespace Statecraft.Game.UI
new Length(PortraitFraming.PositionYPercent(portrait.width, portrait.height, PortraitWidth, PortraitHeight, entry!.Value.focusY), LengthUnit.Percent));
card.Q<Label>("event-draft").style.display = e.Status == "draft" ? DisplayStyle.Flex : DisplayStyle.None;
card.Q<Label>("event-title").text = EventSystem.Title(c, s, e);
- card.Q<Label>("event-office").text = holder == null ? "" : text.Format("event.office", c.Offices.First(o => o.Id == e.Office).Title, holder.Name);
+ var office = holder == null ? null : c.Offices.First(o => o.Id == e.Office);
+ card.Q<Label>("event-office").text = holder == null ? "" : text.Format("event.office", ContentNames.Of(text, office!, holder), ContentNames.Of(text, holder));
card.Q<Label>("event-text").text = EventSystem.Render(c, s, e);
var objective = card.Q<Label>("event-objective"); // an objective card's line (#380); none on any other card
objective.text = ObjectiveLine(c, s, e, text);
diff --git a/unity/Assets/Tests/EditMode/BudgetScreenTests.cs b/unity/Assets/Tests/EditMode/BudgetScreenTests.cs
index d20e9d01f..65e85d35a 100644
--- a/unity/Assets/Tests/EditMode/BudgetScreenTests.cs
+++ b/unity/Assets/Tests/EditMode/BudgetScreenTests.cs
@@ -244,6 +244,23 @@ public class BudgetScreenTests
StringAssert.EndsWith("(אין משרד עד 10 במרץ 1949)", ui.Q<Label>("budget-education_minister-name").text);
}
+ [Test]
+ public void InHebrewTheRowsAndVoteUseTheContentsHebrewNames()
+ {
+ var he = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");
+ var c = ContentLoader.Load(Paths.Content);
+ c.Rules.BudgetStart["rationing_minister"] = 0; // expose the non-budgeted fallback row through the real presenter
+ var g = GameSession.New(c, GoldenRun.Seed, Mode.Historical);
+ while (g.State.Date < new System.DateTime(1950, 12, 1)) g.Step(HistoricalAI.Commands(c, g.State));
+ using var ui = new UiTestKit();
+ new BudgetPresenter(ui.Root, new SimBridge(g, he), he);
+ Assert.AreEqual("שרת העבודה (גולדה מאיר)", ui.Q<Label>("budget-labour_minister-name").text, "the feminine title for her");
+ var rationing = c.Offices.Single(o => o.Id == "rationing_minister");
+ Assert.AreEqual("", rationing.TitleHe);
+ Assert.AreEqual(rationing.Title + " (פנחס לבון)", ui.Q<Label>("budget-rationing_minister-name").text, "only the missing office title falls back");
+ StringAssert.Contains(Offices.Legislature(c, g.State.Date)!.BodyHe, ui.Q<Label>("budget-vote").text);
+ }
+
/// <summary>Playtest 1, item 6: a vacant ministry reads "(vacant)", as on the Cabinet screen, never "(-)".</summary>
[Test]
public void AVacantMinistryReadsVacant()
diff --git a/unity/Assets/Tests/EditMode/EventCardTests.cs b/unity/Assets/Tests/EditMode/EventCardTests.cs
index 4d07ff73b..4acba432f 100644
--- a/unity/Assets/Tests/EditMode/EventCardTests.cs
+++ b/unity/Assets/Tests/EditMode/EventCardTests.cs
@@ -51,6 +51,21 @@ public class EventCardTests
Assert.AreEqual("Sign the armistice", ui.Q<Button>("option-sign").text);
}
+ [Test]
+ public void InHebrewTheOfficeLineUsesTheFeminineTitleAndHebrewName()
+ {
+ var he = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");
+ var c = ContentLoader.Load(Paths.Content);
+ var e = c.Events.First(x => x.Id == "armistice_egypt");
+ e.Office = "labour_minister";
+ var g = GameSession.New(c, GoldenRun.Seed, Mode.Historical);
+ g.State.Date = new System.DateTime(1950, 2, 1);
+ g.State.PendingEvents.Clear(); g.State.PendingEvents.Add(e.Id);
+ using var ui = new UiTestKit();
+ new EventCardPresenter(ui.Root, new SimBridge(g, he), he, null);
+ Assert.AreEqual("שרת העבודה: גולדה מאיר", ui.Q<Label>("event-office").text);
+ }
+
[Test]
public void AMinisterWithoutAPortraitShowsNoImage()
{