A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
ui: Hebrew prefixes join place and person names directly; a maqaf only before a digit or English (Refs #1527) (#1636)
Eyal Golanb53b15968d57
diff --git a/changelog.d/he-prefix-joining.md b/changelog.d/he-prefix-joining.mdnew file mode 100644index 000000000..0b4cddecb--- /dev/null+++ b/changelog.d/he-prefix-joining.md@@ -0,0 +1,2 @@+- Hebrew place and person names now join a one-letter prefix directly ("לחיפה", "בתל אביב"); a maqaf stays only before a+ digit or a name still shown in English. A hex off a town now reads "10 ק״מ מדרום־מערב לחיפה" (Refs #1527).diff --git a/docs/WRITING_UI_HE.md b/docs/WRITING_UI_HE.mdindex 1e5287889..2d22dfa0b 100644--- a/docs/WRITING_UI_HE.md+++ b/docs/WRITING_UI_HE.md@@ -98,6 +98,8 @@ For the native reviewer: record any overrule of the adopted ״ convention, and c### HE-07 MaqafStatus: proposed, native. Reason: the Academy's punctuation rules use a maqaf when a prefix meets a numeral or Latin letters, for example "ה־12" and "ב־DNA". r12a says the maqaf is the proper character for a hyphen between compounds, that keyboards often lack it so a hyphen-minus is substituted, and that lines should not break next to it.- Today: "יישובים ב-1948: {0}" (`info.localities`) uses a hyphen-minus. "מ־{0} עד {1}" (`why.turn`) uses a maqaf. The date pattern joins the prefix to the month name with no hyphen ("{0} ב{1} {2}", `date.day_month_year`), which is ordinary Hebrew for a prefix before a word.+- Code: a placeholder written straight after a prefix ("ב{0}") is joined to a Hebrew value ("בתל אביב"), and UiText.Format adds the maqaf when the value starts with a digit or a Latin letter ("ב־Haifa", for a name with no Hebrew form yet). Write "ב־{0}" only where the value is always a numeral or a date.+- Native review: owner, 25 Oct 2026 (recommendations page), #1636: direct joining before Hebrew names, the maqaf only before a numeral or Latin letters, and "10 ק״מ מדרום־מערב לחיפה" for `why.hex.away`.- Candidate: "יישובים ב־1948: {0}".- A second place: the map legend joins two colour words with a hyphen-minus, "כתום-אדום" (`map.legend_held`, also `map.legend_armistice`). r12a's note on the hyphen between compounds points to the maqaf there too. Candidate: "כתום־אדום".For the native reviewer: confirm the maqaf for prefixes before numerals and Latin letters, for the colour compound, and the numeral range style in `why.turn`.diff --git a/unity/Assets/Scripts/UI/UiText.cs b/unity/Assets/Scripts/UI/UiText.csindex f83d643a9..438cb568a 100644--- a/unity/Assets/Scripts/UI/UiText.cs+++ b/unity/Assets/Scripts/UI/UiText.cs@@ -44,7 +44,9 @@ namespace Statecraft.Game.UI/// line the bidi rules would otherwise draw "-$4.2m" as "$4.2m-" and split "15 May 1948" into "May 1948 15". A value/// with Hebrew in it is left alone: a Hebrew word (a seat unit) between marks would make the space next to it left to/// right, and a value Format has already made from a Hebrew pattern has its own values marked. Every other pattern,- /// so all of English, gives string.Format's text unchanged.</summary>+ /// so all of English, gives string.Format's text unchanged. A value written straight after a Hebrew letter (a+ /// one-letter prefix, "ל{2}") takes a maqaf when it starts with a digit or a Latin letter (HE-07): "לחיפה" but+ /// "ל־Haifa" where a name has no Hebrew form yet.</summary>public string Format(string key, params object[] args){var pattern = this[key];@@ -56,10 +58,29 @@ namespace Statecraft.Game.UI{if (!m.Groups[1].Success) return m.Value.Substring(1); // "{{" or "}}"var value = string.Format(CultureInfo.InvariantCulture, "{0" + m.Groups[2].Value + "}", Arg(args, m.Groups[1].Value));- return value.Length == 0 || UiDirection.HasRightToLeft(value) ? value : LeftToRightMark + value + LeftToRightMark;+ var marked = value.Length == 0 || UiDirection.HasRightToLeft(value) ? value : LeftToRightMark + value + LeftToRightMark;+ return m.Index > 0 && IsHebrewLetter(pattern[m.Index - 1]) && StartsWithNumeralOrLatin(value) ? Maqaf + marked : marked;});}+ /// <summary>U+05BE HEBREW PUNCTUATION MAQAF.</summary>+ const char Maqaf = '\u05BE';++ static bool IsHebrewLetter(char c) => c >= '\u05D0' && c <= '\u05EA';++ /// <summary>Whether the value's first letter or digit, past any direction mark, is a digit or a non-Hebrew letter+ /// (HE-07: a prefix joins a Hebrew word directly, "לחיפה", and takes a maqaf before a numeral or Latin letters,+ /// "ל־Haifa", "ב־15 במאי 1948").</summary>+ static bool StartsWithNumeralOrLatin(string value)+ {+ foreach (var c in value)+ {+ if (c == LeftToRightMark || c == '\u200F' || c == '\u061C' || c >= '\u202A' && c <= '\u202E' || c >= '\u2066' && c <= '\u2069') continue;+ return char.IsLetterOrDigit(c) && !IsHebrewLetter(c);+ }+ return false;+ }+static object? Arg(object[] args, string index){int i = int.Parse(index, CultureInfo.InvariantCulture);diff --git a/unity/Assets/Tests/EditMode/HebrewValuesTests.cs b/unity/Assets/Tests/EditMode/HebrewValuesTests.csindex 424a119ee..cc8b46122 100644--- a/unity/Assets/Tests/EditMode/HebrewValuesTests.cs+++ b/unity/Assets/Tests/EditMode/HebrewValuesTests.cs@@ -43,6 +43,23 @@ public class HebrewValuesTestsAssert.IsFalse(UiDirection.RightToLeft(appointed), appointed);}+ /// <summary>HE-07: a value written straight after a Hebrew letter, a one-letter prefix ("ב{0}"), is joined to it when+ /// it starts with a Hebrew letter, ה included and a name of two words alike, and takes a maqaf when it starts with a+ /// digit or a Latin letter. A prefix the pattern already gives a maqaf ("ב־{0}", a date) gets no second one.</summary>+ [Test]+ public void APrefixJoinsAHebrewValueAndTakesAMaqafBeforeADigitOrLatinLetters()+ {+ Assert.AreEqual("ליחידה בהרצליה אין משבצת פנויה סמוכה לסגת אליה.", He.Format("capture.refusal.no_free_hex", "הרצליה"));+ Assert.AreEqual("ליחידה בתל אביב אין משבצת פנויה סמוכה לסגת אליה.", He.Format("capture.refusal.no_free_hex", "תל אביב"));+ Assert.AreEqual("ליחידה ב־" + Lrm + "Herzliya" + Lrm + " אין משבצת פנויה סמוכה לסגת אליה.",+ He.Format("capture.refusal.no_free_hex", "Herzliya"));+ Assert.AreEqual("ב־" + Lrm + "3" + Lrm + " אין מים עבור דיור", He.Format("city.project_reason.no_resource", "3", "מים", "דיור"));+ // The value itself unprefixed is left as it was.+ Assert.AreEqual(Lrm + "Herzliya" + Lrm + " כבר עיר.", He.Format("capture.refusal.already_city", "Herzliya"));+ Assert.AreEqual("נוסד ב־" + Lrm + "15" + Lrm + " במאי " + Lrm + "1948" + Lrm,+ He.Format("site.built", He.Format("date.day_month_year", 15, He["date.month_5"], 1948)));+ }+/// <summary>A value with Hebrew in it is not wrapped. A Hebrew word (the seat unit by body, #550) between marks would/// make the space between it and an English neighbour left to right, and the space would move to the wrong side; a/// value Format has made from a Hebrew pattern (the spoken amount inside the meter's spoken line) has its own values@@ -109,26 +126,41 @@ public class HebrewValuesTestsAssert.AreEqual("15 May 1948 to 1 June 1948", en.Format("why.turn", "15 May 1948", "1 June 1948"));}- /// <summary>Every Hebrew key formats to the English-free pattern with marks only around the values: taking the marks- /// out gives string.Format's text back.</summary>+ /// <summary>Every Hebrew key formats to the English-free pattern with marks only around the values, and a maqaf only+ /// where a value written straight after a Hebrew letter starts with a digit or a Latin letter (HE-07): taking the marks+ /// out gives string.Format's text back with that maqaf, at exactly that place, and nowhere else.</summary>[Test]public void TakingTheMarksOutOfAnyHebrewLineGivesTheOldTextBack(){var he = He;var args = new object[] { "$-4.2m", "15 May 1948", 2.5, 46, "IL 3.0m", "Mapai", 7, 1948 };- int wrapped = 0;+ int wrapped = 0, joined = 0;foreach (var key in Keys(UiPaths.StringsHebrew)){- string expected;- try { expected = Plain(he, key, args); }+ try { Plain(he, key, args); }catch (FormatException) { continue; }+ var pattern = he[key];+ var expected = FormatItem.Replace(pattern, m =>+ {+ if (!m.Groups[1].Success) return m.Value.Substring(1);+ var value = string.Format(CultureInfo.InvariantCulture, "{0" + m.Groups[2].Value + "}", args[int.Parse(m.Groups[1].Value, CultureInfo.InvariantCulture)]);+ var maqaf = m.Index > 0 && pattern[m.Index - 1] >= 'א' && pattern[m.Index - 1] <= 'ת'+ && value.Length > 0 && char.IsLetterOrDigit(value[0]) && !(value[0] >= 'א' && value[0] <= 'ת');+ if (maqaf) joined++;+ return (maqaf ? "־" : "") + value;+ });var got = he.Format(key, args);Assert.AreEqual(expected, got.Replace(Lrm, ""), key);if (got.IndexOf(Lrm, StringComparison.Ordinal) >= 0) wrapped++;}Assert.Greater(wrapped, 20, "Hebrew templates with values are wrapped");+ Assert.Greater(joined, 0, "a prefix before a digit or Latin value takes a maqaf");}+ // UiText's format item, an escaped brace included.+ static readonly System.Text.RegularExpressions.Regex FormatItem =+ new System.Text.RegularExpressions.Regex(@"\{\{|\}\}|\{(\d+)((?:,\s*-?\d+)?(?::[^{}]*)?)\}");+[Test]public void TheFirstLetterRuleSkipsTheMarks(){diff --git a/unity/Assets/Tests/EditMode/WhyHexPlacesTests.cs b/unity/Assets/Tests/EditMode/WhyHexPlacesTests.csindex 111eff935..b87a38750 100644--- a/unity/Assets/Tests/EditMode/WhyHexPlacesTests.cs+++ b/unity/Assets/Tests/EditMode/WhyHexPlacesTests.cs@@ -43,11 +43,27 @@ public class WhyHexPlacesTests{// (6,8) is the hex east of Haifa's (5,8): 8.5 km between the centres, said to the nearest 5 km.Assert.AreEqual(GolaniName(En) + " moved to a hex 10 km east of Haifa for 2 movement points", UnitNames.Line(Moved("6,8", 2), C, Rows, En));- StringAssert.Contains("משושה 10 ק״מ מזרחית ל־חיפה", UnitNames.Line(Moved("6,8", 2), C, Rows, He, NamesHe));+ StringAssert.Contains("משושה 10 ק״מ ממזרח לחיפה", UnitNames.Line(Moved("6,8", 2), C, Rows, He, NamesHe));// (-3,20) is one hex from Tel Aviv, Lod and Rishon LeZion alike: the first in settlement_hexes.yaml's order wins.StringAssert.Contains("a hex 10 km south-east of Tel Aviv", UnitNames.Line(Moved("-3,20", 2), C, Rows, En));}+ /// <summary>A one-letter prefix joins a Hebrew place name directly, a name of two words included ("לחיפה", "בתל+ /// אביב"), and takes a maqaf before a name with no Hebrew form yet, which is shown in English (HE-07: "מ־Jaffa").</summary>+ [Test]+ public void APrefixJoinsAHebrewPlaceNameAndTakesAMaqafBeforeAnEnglishOne()+ {+ const char lrm = UiText.LeftToRightMark;+ StringAssert.Contains("אזרחים בתל אביב", UnitNames.Line(new Cause("map", "0", 0, "", key: WhyKeys.SentHome,+ units: new[] { Golani }, args: new[] { "500", "tel_aviv" }), C, Rows, He, NamesHe));+ // NamesHe has no Jaffa: its English name, after a maqaf. The hex it withdrew to is Haifa's, in Hebrew.+ StringAssert.Contains("נסיגה מ־" + lrm + "Jaffa" + lrm + " למשושה חיפה", UnitNames.Line(new Cause("map", "0", 0, "",+ key: WhyKeys.Withdrew, units: new[] { Golani }, args: new[] { "jaffa", "5,8" }), C, Rows, He, NamesHe));+ // No Hebrew names at all: Haifa in English, after a maqaf.+ StringAssert.Contains("משושה " + lrm + "10" + lrm + " ק״מ ממזרח ל־" + lrm + "Haifa" + lrm,+ UnitNames.Line(Moved("6,8", 2), C, Rows, He, null));+ }+/// <summary>Every unit line, in both languages, with a hex of negative q (the Hebrew bidi case: "-3,20" showed as/// "3,20-"): no coordinates remain.</summary>[Test]diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yamlindex cc27975cf..e6311c2f9 100644--- a/unity/Assets/UI/strings.he.yaml+++ b/unity/Assets/UI/strings.he.yaml@@ -181,7 +181,7 @@ event.rejoin: "חוזר למסלול ההיסטורי."# Agent-drafted, for the native reviewer (#564). Q-UI-1 (b): direct Hebrew equivalents of the GDD's words, except the# owner's own (22 October 2026, #1317): Occupy is "שחרור", and the Deport line is the owner's "displaced" wording.# Gender-neutral phrasing ("יש לבחור").-capture.intro: "כוחות ישראליים מחזיקים ב־{0}, ואין שם כוחות אויב. יש לבחור מה יקרה עכשיו. הבחירה תיכנס לתוקף בסיום התור; עד שתיבחר אפשרות, הכוחות נשארים במקום."+capture.intro: "כוחות ישראליים מחזיקים ב{0}, ואין שם כוחות אויב. יש לבחור מה יקרה עכשיו. הבחירה תיכנס לתוקף בסיום התור; עד שתיבחר אפשרות, הכוחות נשארים במקום."capture.option.raid: "פשיטה ונסיגה"capture.option.occupy: "שחרור"capture.option.deport: "גירוש"@@ -200,7 +200,7 @@ capture.none: "אף אחת מהאפשרויות אינה זמינה בתור הcapture.reopen: "החלטה ממתינה: {0}"# The end of an occupation (#802). SENSITIVE, agent-drafted, for the native reviewer (#564). The state is "held" (מוחזק,# תקופת ההחזקה; owner, #803), never שחרור, which is Occupy's name only (owner, #1317). Direct option names: סיפוח, נסיגה.-capture.end.intro: "תקופת ההחזקה ב־{0} הסתיימה. יש לבחור אם לספח את המקום או לסגת ממנו. הבחירה תיכנס לתוקף בסיום התור; עד שתיבחר אפשרות, היחידה נשארת במקום ועלות ההחזקה נמשכת."+capture.end.intro: "תקופת ההחזקה ב{0} הסתיימה. יש לבחור אם לספח את המקום או לסגת ממנו. הבחירה תיכנס לתוקף בסיום התור; עד שתיבחר אפשרות, היחידה נשארת במקום ועלות ההחזקה נמשכת."capture.end.option.annex: "סיפוח"capture.end.option.withdraw: "נסיגה"capture.end.about.annex_fled: "המקום נשאר בשליטה ישראלית. תושביו נמלטו בעת הכיבוש, ולכן לא מתווספים תושבים, בתים או מקומות עבודה. עלות ההחזקה מסתיימת, ואין צורך להשאיר יחידה במקום."@@ -211,8 +211,8 @@ capture.end.changes_none: "שינויים מיידיים במשאבים: אין"capture.end.none: "אף אחת מהאפשרויות אינה זמינה בתור הזה. היחידה נשארת במקום, עלות ההחזקה נמשכת, וההחלטה ממתינה."# Why an option cannot be chosen (#802), by the sim's refusal id. SENSITIVE, agent-drafted, for the native reviewer (#564).capture.refusal.attention: "אין די תשומת לב בתור הזה: נדרש {1:0.0}, ונותר {2:0.0}."-capture.refusal.needs_unit: "לשם כך נדרשת יחידה צבאית ישראלית ב־{0}."-capture.refusal.no_free_hex: "ליחידה ב־{0} אין משבצת פנויה סמוכה לסגת אליה."+capture.refusal.needs_unit: "לשם כך נדרשת יחידה צבאית ישראלית ב{0}."+capture.refusal.no_free_hex: "ליחידה ב{0} אין משבצת פנויה סמוכה לסגת אליה."capture.refusal.no_one_to_deport: "תושביו נמלטו בעת הכיבוש, ולכן אין את מי לגרש."capture.refusal.already_city: "{0} כבר עיר."capture.refusal.not_awaiting: "{0} אינו ממתין להחלטה הזו."@@ -326,24 +326,28 @@ why.line.destroyed: "{0}: היחידה הושמדה"why.line.retreated: "{0}: נסיגה למשושה {1}"why.line.surrendered_prisoners: "{0}: כניעה עם {1:N0} איש, כי לא היה משושה לסגת אליו. הם מוחזקים כשבויים"why.line.surrendered_held: "{0}: כניעה עם {1:N0} איש, כי לא היה משושה לסגת אליו. הם מוחזקים בידי האויב"-why.line.sent_home: "{0}: שחרור הביתה; {1:N0} איש הם כעת אזרחים ב־{2}"-why.line.withdrew: "{0}: נסיגה מ־{1} למשושה {2}"+why.line.sent_home: "{0}: שחרור הביתה; {1:N0} איש הם כעת אזרחים ב{2}"+why.line.withdrew: "{0}: נסיגה מ{1} למשושה {2}"why.line.on_its_way: "{0} בדרך למשושה {1}"why.line.stopped_no_route: "{0}: עצירה, כי אין מסלול שמגיע למשושה {1}"why.line.stopped_full: "{0}: עצירה, כי משושה {1} מלא"why.line.arrived: "{0}: הגעה למשושה {1}"# A hex in the unit lines (HexPlaces), after the lines' "משושה": a settlement's hex is its name alone ("משושה חיפה"); any# other hex is said from the nearest settlement, {0} the km (to the nearest 5), {1} the compass point, {2} the settlement,-# with a maqaf after the prefix as in why.line.sent_home. Agent-drafted Hebrew; native review pending (#564).-why.hex.away: "{0} ק״מ {1} ל־{2}"-why.hex.north: "צפונית"-why.hex.north_east: "צפון־מזרחית"-why.hex.east: "מזרחית"-why.hex.south_east: "דרום־מזרחית"-why.hex.south: "דרומית"-why.hex.south_west: "דרום־מערבית"-why.hex.west: "מערבית"-why.hex.north_west: "צפון־מערבית"+# joined to its prefix ("לחיפה"). Native review: owner, 25 Oct 2026 (recommendations page), #1636: why.hex.away, the+# eight why.hex.<point> words, and a one-letter prefix joined straight to a name placeholder ("ל{2}", "ב{0}", "מ{1}") in+# why.line.sent_home, why.line.withdrew, capture.intro, capture.end.intro, capture.refusal.needs_unit,+# capture.refusal.no_free_hex, cabinet.reason.not_career_officer and city.project_reason.no_resource. UiText.Format adds+# the maqaf before a digit or a Latin letter (HE-07).+why.hex.away: "{0} ק״מ {1} ל{2}"+why.hex.north: "מצפון"+why.hex.north_east: "מצפון־מזרח"+why.hex.east: "ממזרח"+why.hex.south_east: "מדרום־מזרח"+why.hex.south: "מדרום"+why.hex.south_west: "מדרום־מערב"+why.hex.west: "ממערב"+why.hex.north_west: "מצפון־מערב"# The turn report (#1037, TurnReportPresenter): a line is a top-bar caption and the change the bar shows.report.title: "מה קרה בתור הזה"report.intro: "מה השתנה בסרגל העליון, ומה הסיבות העיקריות:"@@ -505,7 +509,7 @@ cabinet.reason.is_president: "{0} כבר בתפקיד הנשיא"cabinet.reason.is_chief_of_staff: "{0} כבר בתפקיד הרמטכ״ל"cabinet.reason.already_holds: "{0} כבר בתפקיד {1}"cabinet.reason.no_government: "אין ממשלה מכהנת"-cabinet.reason.not_career_officer: "ל־{0} אין שירות קבע בצה״ל"+cabinet.reason.not_career_officer: "ל{0} אין שירות קבע בצה״ל"cabinet.reason.party_not_coalition: "{0} ממפלגת {1}, שאינה בקואליציה"info.biome.sea: "ים"info.biome.lake: "אגם"@@ -651,7 +655,7 @@ city.project_start: "הקמת {0}: {1}, {2}"city.project_ordered: "הוזמנה הקמת {0}"city.project_building: "{0} עבור {1}: עוד {2}"city.project_built: "{0} עבור {1}: הבנייה הושלמה ב־{2}"-city.project_reason.no_resource: "ב־{0} אין {1} עבור {2}"+city.project_reason.no_resource: "ב{0} אין {1} עבור {2}"# turn_cap: approved by Beri, a native speaker, on #1267 (21 Oct 2026).city.project_reason.turn_cap: "אי אפשר להתחיל יותר מ־{0} מיזמים עירוניים בתור אחד"# The toggle that folds a city's own projects on a stacked bar or a short window (owner ruling on #1150), {0} the