Skip to content

Translate displayMessage events via events_display keys - #2847

Merged
evanpelle merged 4 commits into
openfrontio:mainfrom
Aotumuri:mls-event-display
Jan 11, 2026
Merged

evanpelle merged 4 commits into
openfrontio:mainfrom
Aotumuri:mls-event-display

Conversation

@Aotumuri

Copy link
Copy Markdown
Member

If this PR fixes an issue, link it below. If not, delete these two lines.
Resolves #1225

Description:

Replace all raw displayMessage strings with events_display.* keys + params and add the new English translations in resources/
lang/en.json so EventsDisplay can translate them.

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

aotumuri

@Aotumuri
Aotumuri requested a review from a team as a code owner January 10, 2026 05:00
@CLAassistant

CLAassistant commented Jan 10, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Aotumuri
❌ ryanbarlow97
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jan 10, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR localizes multiple user-facing event messages: adds new events_display.* keys to resources/lang/en.json and replaces hardcoded strings with those keys, passing structured payloads to displayMessage across attack, SAM/missile, trade, transport, donation, and unit event paths.

Changes

Cohort / File(s) Summary
Translation Definitions
resources/lang/en.json
Added 14 new events_display.* keys (attack_cancelled_retreat, received_gold_from_captured_ship, received_gold_from_trade, missile_intercepted, mirv_warheads_intercepted, sent_troops_to_player, received_troops_from_player, sent_gold_to_player, received_gold_from_player, unit_captured_by_enemy, captured_enemy_unit, unit_destroyed, no_boats_available) and a punctuation fix for betrayal_debuff_ends.
Attack & Transport
src/core/execution/AttackExecution.ts, src/core/execution/TransportShipExecution.ts
Replaced hardcoded retreat/no-boats messages with events_display.attack_cancelled_retreat and events_display.no_boats_available; added payloads (troops, max).
SAM / Missile Handling
src/core/execution/SAMLauncherExecution.ts, src/core/execution/SAMMissileExecution.ts
Replaced interception messages with events_display.mirv_warheads_intercepted and events_display.missile_intercepted; added payloads (counts, intercepted unit type).
Trade & Ships
src/core/execution/TradeShipExecution.ts
Converted captured-ship and trade gold messages to events_display.received_gold_from_captured_ship and events_display.received_gold_from_trade, passing { gold, name } payloads.
Player & Unit Events
src/core/game/PlayerImpl.ts, src/core/game/UnitImpl.ts
Localized donation and unit capture/destruction messages (sent/received troops/gold, unit_captured_by_enemy, captured_enemy_unit, unit_destroyed) and included structured payload metadata (amounts, names, unit types).

Sequence Diagram(s)

(omitted — changes are message/localization replacements without new multi-component control flow)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Translation - New

Suggested reviewers

  • evanpelle
  • scottanderson

Poem

Strings once plain now wear a key,
Payloads bring context, clear to see.
Battles, trades, and ships unite,
Messages ready for every site. 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: replacing raw displayMessage strings with localized events_display keys.
Description check ✅ Passed The description is related to the changeset, explaining the replacement of raw strings with translation keys and addition of new English translations.
Linked Issues check ✅ Passed The PR successfully addresses issue #1225 by replacing raw displayMessage strings with localized events_display keys and adding corresponding English translations to resources/lang/en.json.
Out of Scope Changes check ✅ Passed All changes are focused on localization of displayMessage events via events_display keys, with no unrelated modifications detected outside the stated objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b1364e and 75c4505.

📒 Files selected for processing (1)
  • resources/lang/en.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • resources/lang/en.json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/core/game/PlayerImpl.ts (2)

660-681: Donation message should use actual transferred troops (removed), not requested troops.

Proposed fix
     const removed = this.removeTroops(troops);
     if (removed === 0) return false;
     recipient.addTroops(removed);
@@
     this.mg.displayMessage(
       "events_display.sent_troops_to_player",
       MessageType.SENT_TROOPS_TO_PLAYER,
       this.id(),
       undefined,
-      { troops: renderTroops(troops), name: recipient.name() },
+      { troops: renderTroops(removed), name: recipient.displayName() },
     );
     this.mg.displayMessage(
       "events_display.received_troops_from_player",
       MessageType.RECEIVED_TROOPS_FROM_PLAYER,
       recipient.id(),
       undefined,
-      { troops: renderTroops(troops), name: this.name() },
+      { troops: renderTroops(removed), name: this.displayName() },
     );

684-706: Donation message should use actual transferred gold (removed) — and the 4th arg should match too.

Proposed fix
     const removed = this.removeGold(gold);
     if (removed === 0n) return false;
     recipient.addGold(removed);
@@
     this.mg.displayMessage(
       "events_display.sent_gold_to_player",
       MessageType.SENT_GOLD_TO_PLAYER,
       this.id(),
       undefined,
-      { gold: renderNumber(gold), name: recipient.name() },
+      { gold: renderNumber(removed), name: recipient.displayName() },
     );
     this.mg.displayMessage(
       "events_display.received_gold_from_player",
       MessageType.RECEIVED_GOLD_FROM_PLAYER,
       recipient.id(),
-      gold,
-      { gold: renderNumber(gold), name: this.name() },
+      removed,
+      { gold: renderNumber(removed), name: this.displayName() },
     );
🧹 Nitpick comments (1)
src/core/execution/AttackExecution.ts (1)

189-197: Consider passing raw deaths (number) to i18n instead of a pre-rendered string.
Pre-rendering (renderTroops) can make non-English formatting harder and can hide rounding differences if deaths is not an int.

Proposed tweak (if translations can format numbers)
-      this.mg.displayMessage(
-        "events_display.attack_cancelled_retreat",
-        MessageType.ATTACK_CANCELLED,
-        this._owner.id(),
-        undefined,
-        { troops: renderTroops(deaths) },
-      );
+      this.mg.displayMessage(
+        "events_display.attack_cancelled_retreat",
+        MessageType.ATTACK_CANCELLED,
+        this._owner.id(),
+        undefined,
+        { troops: deaths },
+      );
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 240690c and 7510b6a.

📒 Files selected for processing (8)
  • resources/lang/en.json
  • src/core/execution/AttackExecution.ts
  • src/core/execution/SAMLauncherExecution.ts
  • src/core/execution/SAMMissileExecution.ts
  • src/core/execution/TradeShipExecution.ts
  • src/core/execution/TransportShipExecution.ts
  • src/core/game/PlayerImpl.ts
  • src/core/game/UnitImpl.ts
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: TheGiraffe3
Repo: openfrontio/OpenFrontIO PR: 884
File: resources/lang/en.json:456-461
Timestamp: 2025-08-16T10:52:08.292Z
Learning: In OpenFrontIO, translation files in resources/lang/*.json (except en.json) should not be updated in regular PRs. Only dedicated translation PRs titled "mls" and made by Aotumori should update non-English locale files. Regular PRs should only update en.json when adding or modifying translation keys.
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 949
File: resources/lang/en.json:8-10
Timestamp: 2025-05-30T03:53:52.231Z
Learning: For the OpenFrontIO project, do not suggest updating translation files in resources/lang/*.json except for en.json. The project has a dedicated translation team that handles all other locale files.
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: For the window close confirmation feature in `ClientGameRunner.ts`, the troop count requirement (>10,000 troops) from issue #2137 was intentionally removed because it was arbitrary and troop count can be reported as low despite having significant land. The confirmation now triggers for any alive player regardless of troop count.

Applied to files:

  • src/core/execution/TransportShipExecution.ts
  • src/core/execution/AttackExecution.ts
  • src/core/game/PlayerImpl.ts
📚 Learning: 2025-05-31T18:15:03.445Z
Learnt from: 1brucben
Repo: openfrontio/OpenFrontIO PR: 977
File: src/core/execution/AttackExecution.ts:123-125
Timestamp: 2025-05-31T18:15:03.445Z
Learning: The removeTroops function in PlayerImpl.ts already prevents negative troop counts by using minInt(this._troops, toInt(troops)) to ensure it never removes more troops than available.

Applied to files:

  • src/core/execution/TransportShipExecution.ts
  • src/core/execution/AttackExecution.ts
  • src/core/game/PlayerImpl.ts
📚 Learning: 2025-10-20T20:15:28.858Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:51-51
Timestamp: 2025-10-20T20:15:28.858Z
Learning: In src/core/execution/FakeHumanExecution.ts, game balance constants like MIRV_COOLDOWN_TICKS, MIRV_HESITATION_ODDS, VICTORY_DENIAL_TEAM_THRESHOLD, VICTORY_DENIAL_INDIVIDUAL_THRESHOLD, and STEAMROLL_CITY_GAP_MULTIPLIER are experimental tuning parameters subject to frequent change during balance testing. Do not flag changes to these values as issues or compare them against previous values.

Applied to files:

  • src/core/execution/AttackExecution.ts
  • src/core/execution/SAMLauncherExecution.ts
  • src/core/execution/SAMMissileExecution.ts
📚 Learning: 2025-08-29T16:16:11.309Z
Learnt from: BrewedCoffee
Repo: openfrontio/OpenFrontIO PR: 1957
File: src/core/execution/PlayerExecution.ts:40-52
Timestamp: 2025-08-29T16:16:11.309Z
Learning: In OpenFrontIO PlayerExecution.ts, when Defense Posts are captured due to tile ownership changes, the intended behavior is to first call u.decreaseLevel() to downgrade them, then still transfer them to the capturing player via captureUnit(). This is not a bug - Defense Posts should be both downgraded and captured, not destroyed outright.

Applied to files:

  • src/core/game/UnitImpl.ts
📚 Learning: 2025-08-12T00:31:50.144Z
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 1752
File: src/core/game/Game.ts:750-752
Timestamp: 2025-08-12T00:31:50.144Z
Learning: In the OpenFrontIO codebase, changes to the PlayerInteraction interface (like adding canDonateGold and canDonateTroops flags) do not require corresponding updates to src/core/Schemas.ts or server serialization code.

Applied to files:

  • src/core/game/UnitImpl.ts
  • src/core/game/PlayerImpl.ts
📚 Learning: 2025-08-24T11:13:08.495Z
Learnt from: DevelopingTom
Repo: openfrontio/OpenFrontIO PR: 1900
File: src/core/execution/SAMLauncherExecution.ts:103-111
Timestamp: 2025-08-24T11:13:08.495Z
Learning: In SAMLauncherExecution.ts, the cached target bug can only occur if: 1) SAM is not on cooldown when nuke is in range, 2) SAM goes on cooldown right after computing trajectory, 3) SAM becomes available again before nuke explodes. This is not possible with current cooldown values but the fix is still valuable for robustness.

Applied to files:

  • src/core/execution/SAMLauncherExecution.ts
  • src/core/execution/SAMMissileExecution.ts
📚 Learning: 2025-10-18T17:54:01.311Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:172-173
Timestamp: 2025-10-18T17:54:01.311Z
Learning: In src/core/execution/FakeHumanExecution.ts, MIRVs and ground attacks should not be mutually exclusive. The considerMIRV() method should not short-circuit maybeAttack() - both actions can occur in the same tick.

Applied to files:

  • src/core/execution/SAMLauncherExecution.ts
  • src/core/execution/SAMMissileExecution.ts
📚 Learning: 2025-08-27T08:12:19.610Z
Learnt from: mokizzz
Repo: openfrontio/OpenFrontIO PR: 1940
File: resources/lang/en.json:763-766
Timestamp: 2025-08-27T08:12:19.610Z
Learning: In OpenFrontIO, some country entries in src/client/data/countries.json may have similar names but different codes (e.g., "Empire of Japan" vs "Empire of Japan1"). Each unique code requires its own translation key in resources/lang/en.json after normalization. Always verify against countries.json before suggesting removal of translation keys.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-06-02T14:27:37.609Z
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-08-16T10:52:08.292Z
Learnt from: TheGiraffe3
Repo: openfrontio/OpenFrontIO PR: 884
File: resources/lang/en.json:456-461
Timestamp: 2025-08-16T10:52:08.292Z
Learning: In OpenFrontIO, translation files in resources/lang/*.json (except en.json) should not be updated in regular PRs. Only dedicated translation PRs titled "mls" and made by Aotumori should update non-English locale files. Regular PRs should only update en.json when adding or modifying translation keys.

Applied to files:

  • resources/lang/en.json
🧬 Code graph analysis (3)
src/core/execution/TransportShipExecution.ts (1)
src/client/Utils.ts (1)
  • renderTroops (15-17)
src/core/game/PlayerImpl.ts (1)
src/client/Utils.ts (2)
  • renderTroops (15-17)
  • renderNumber (19-43)
src/core/execution/TradeShipExecution.ts (3)
src/core/game/PlayerImpl.ts (1)
  • gold (820-822)
src/core/game/GameView.ts (1)
  • gold (489-491)
src/client/Utils.ts (1)
  • renderNumber (19-43)
🔇 Additional comments (10)
src/core/game/UnitImpl.ts (2)

310-316: unit_destroyed payload is minimal (good); same UnitType formatting check applies.


208-221: The message parameters render correctly.

The translation keys exist and {unit} receives UnitType enum values that are already user-facing strings ("Warship", "City", "Atom Bomb", etc.). The {name} parameter uses displayName() and name() methods, which return formatted player names. Everything works as intended.

src/core/execution/SAMMissileExecution.ts (1)

63-69: The code is correct. UnitType enum values are display strings (e.g., "Atom Bomb", "Hydrogen Bomb"), not raw enum names. Passing this.target.type() directly to the translation params works as intended without requiring conversion.

src/core/execution/SAMLauncherExecution.ts (1)

274-280: i18n implementation is correct. The argument order matches the signature (message, type, playerID, optional goldAmount, optional params), and the translation key "events_display.mirv_warheads_intercepted" uses the {count} placeholder as expected by the params object.

src/core/execution/TransportShipExecution.ts (2)

79-85: LGTM! Localization correctly implemented.

The hardcoded string has been successfully replaced with the localization key events_display.no_boats_available, and the payload properly provides the max value to match the placeholder in the translation string.


274-280: LGTM! Localization correctly implemented.

The hardcoded string has been successfully replaced with the localization key events_display.attack_cancelled_retreat. The payload correctly uses renderTroops() to format the death count for display.

src/core/execution/TradeShipExecution.ts (3)

144-153: LGTM! Localization correctly implemented.

The hardcoded string has been successfully replaced with the localization key events_display.received_gold_from_captured_ship. The payload correctly provides both gold (formatted with renderNumber()) and the original owner's name to match the translation placeholders.


161-170: LGTM! Localization correctly implemented.

The hardcoded string has been successfully replaced with the localization key events_display.received_gold_from_trade. The payload correctly provides the formatted gold amount and the trading partner's name.


171-180: LGTM! Localization correctly implemented.

The hardcoded string has been successfully replaced with the localization key events_display.received_gold_from_trade. The payload correctly provides the formatted gold amount and the destination port owner's name.

resources/lang/en.json (1)

669-683: LGTM! Translation keys correctly added.

All translation keys required by the localization changes have been properly added to en.json. The placeholders in the English text ({troops}, {gold}, {name}, {max}, etc.) correctly match the payload keys used in the code. The English text is grammatically correct and follows a consistent style.

Based on learnings, only en.json should be updated in this PR—other locale files will be handled by dedicated translation PRs.

@VariableVince

VariableVince commented Jan 10, 2026 •

Copy link
Copy Markdown
Contributor

@Aotumuri Nice, although using the displayName in this way won't show the Anynomyous/random/hidden name in the message. See #2412. Since, as stated in a comment there, for PlayerInfo the displayName() is just the same as the name(). Only PlayerView in the other thread actually has the anonymous name in its displayName(). I understand that's not the problem you are trying to solve here, but it may need a follow-up later on to fix #2412 too

@Aotumuri

Copy link
Copy Markdown
Member Author

@Aotumuri Nice, although using the displayName in this way won't show the Anynomyous/random/hidden name in the message. See #2412. Since, as stated in a comment there, for PlayerInfo the displayName() is just the same as the name(). Only PlayerView in the other thread actually has the anonymous name in its displayName(). I understand that's not the problem you are trying to solve here, but it may need a follow-up later on to fix #2412 too

I would like to include the fix in the next PR instead of including it in this one.

ryanbarlow97
ryanbarlow97 previously approved these changes Jan 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @resources/lang/en.json:
- Around line 720-721: Update the two localization entries
"sent_troops_to_player" and "received_troops_from_player" to use the same
singular/plural pluralization pattern used on line 719 so the message renders
"troop" when the count is 1 and "troops" otherwise; specifically replace the
current flat strings with a pluralized form that accepts the {troops} count and
chooses "Sent {troops} troop to {name}" for one and "Sent {troops} troops to
{name}" for other counts (and analogous singular/plural forms for
"received_troops_from_player"), matching the existing localization pattern and
parameter names.
- Line 719: Add separate singular and plural localization keys in en.json: keep
"mirv_warheads_intercepted" for plural and add "mirv_warhead_intercepted":
"{count} MIRV warhead intercepted". Then update the code that formats the
message in the SAMLauncherExecution class (the method that builds the
interception event message in src/core/execution/SAMLauncherExecution.ts) to
choose the singular key when count === 1 and the plural key otherwise, mirroring
the pattern used for duration_second/duration_seconds_plural in EventsDisplay;
use the same i18n lookup function already used in that file and pass the count
into the selected key.
🧹 Nitpick comments (3)
resources/lang/en.json (3)

715-727: Consider consistent punctuation across event messages.

Line 715 ends with a period, while lines 716-727 don't. For consistency and polish, event messages should follow the same punctuation pattern.


718-718: Awkward phrasing for missile interception message.

The phrase "Missile intercepted {unit}" reads unnaturally. Consider rephrasing to "Intercepted missile: {unit}" or "{unit} was intercepted" for better readability.


727-727: Consider clarifying the max boats message.

The phrase "No boats available, max {max}" is functional but could be clearer. Consider "No boats available (max: {max})" or "No boats available, maximum is {max}" for improved clarity.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7510b6a and e4feb8d.

📒 Files selected for processing (1)
  • resources/lang/en.json
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: TheGiraffe3
Repo: openfrontio/OpenFrontIO PR: 884
File: resources/lang/en.json:456-461
Timestamp: 2025-08-16T10:52:08.292Z
Learning: In OpenFrontIO, translation files in resources/lang/*.json (except en.json) should not be updated in regular PRs. Only dedicated translation PRs titled "mls" and made by Aotumori should update non-English locale files. Regular PRs should only update en.json when adding or modifying translation keys.
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.
📚 Learning: 2025-08-27T08:12:19.610Z
Learnt from: mokizzz
Repo: openfrontio/OpenFrontIO PR: 1940
File: resources/lang/en.json:763-766
Timestamp: 2025-08-27T08:12:19.610Z
Learning: In OpenFrontIO, some country entries in src/client/data/countries.json may have similar names but different codes (e.g., "Empire of Japan" vs "Empire of Japan1"). Each unique code requires its own translation key in resources/lang/en.json after normalization. Always verify against countries.json before suggesting removal of translation keys.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-06-02T14:27:37.609Z
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.

Applied to files:

  • resources/lang/en.json

Comment thread resources/lang/en.json Resolved
Comment thread resources/lang/en.json Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @resources/lang/en.json:
- Line 715: The translation string "attack_cancelled_retreat" ends with a
trailing period which is inconsistent with nearby event messages; remove the
final period from the value so it reads "Attack cancelled, {troops} soldiers
killed during retreat" (update the JSON entry for the "attack_cancelled_retreat"
key).
🧹 Nitpick comments (1)
resources/lang/en.json (1)

718-718: Consider clearer wording for interception message.

The current phrasing "Missile intercepted {unit}" could be ambiguous. Consider one of these alternatives:

  • "Intercepted {unit}"
  • "Missile intercepted: {unit}"
  • "{unit} intercepted"

These make it clearer that the {unit} was intercepted, not doing the intercepting.

💡 Alternative wording options
-    "missile_intercepted": "Missile intercepted {unit}",
+    "missile_intercepted": "Intercepted {unit}",

or

-    "missile_intercepted": "Missile intercepted {unit}",
+    "missile_intercepted": "{unit} intercepted",
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4feb8d and 1b1364e.

📒 Files selected for processing (1)
  • resources/lang/en.json
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: TheGiraffe3
Repo: openfrontio/OpenFrontIO PR: 884
File: resources/lang/en.json:456-461
Timestamp: 2025-08-16T10:52:08.292Z
Learning: In OpenFrontIO, translation files in resources/lang/*.json (except en.json) should not be updated in regular PRs. Only dedicated translation PRs titled "mls" and made by Aotumori should update non-English locale files. Regular PRs should only update en.json when adding or modifying translation keys.
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.
📚 Learning: 2025-06-02T14:27:37.609Z
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-08-27T08:12:19.610Z
Learnt from: mokizzz
Repo: openfrontio/OpenFrontIO PR: 1940
File: resources/lang/en.json:763-766
Timestamp: 2025-08-27T08:12:19.610Z
Learning: In OpenFrontIO, some country entries in src/client/data/countries.json may have similar names but different codes (e.g., "Empire of Japan" vs "Empire of Japan1"). Each unique code requires its own translation key in resources/lang/en.json after normalization. Always verify against countries.json before suggesting removal of translation keys.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-08-16T10:52:08.292Z
Learnt from: TheGiraffe3
Repo: openfrontio/OpenFrontIO PR: 884
File: resources/lang/en.json:456-461
Timestamp: 2025-08-16T10:52:08.292Z
Learning: In OpenFrontIO, translation files in resources/lang/*.json (except en.json) should not be updated in regular PRs. Only dedicated translation PRs titled "mls" and made by Aotumori should update non-English locale files. Regular PRs should only update en.json when adding or modifying translation keys.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-10-18T17:54:01.311Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:172-173
Timestamp: 2025-10-18T17:54:01.311Z
Learning: In src/core/execution/FakeHumanExecution.ts, MIRVs and ground attacks should not be mutually exclusive. The considerMIRV() method should not short-circuit maybeAttack() - both actions can occur in the same tick.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-10-27T09:47:26.395Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:770-795
Timestamp: 2025-10-27T09:47:26.395Z
Learning: In src/core/execution/FakeHumanExecution.ts, the selectSteamrollStopTarget() method intentionally allows MIRV targeting when secondHighest city count is 0 (e.g., nuclear endgame scenarios where structures are destroyed). This is valid game design—"if you can afford it, you're good to go"—and should not be flagged as requiring a guard condition.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-10-20T20:15:28.858Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:51-51
Timestamp: 2025-10-20T20:15:28.858Z
Learning: In src/core/execution/FakeHumanExecution.ts, game balance constants like MIRV_COOLDOWN_TICKS, MIRV_HESITATION_ODDS, VICTORY_DENIAL_TEAM_THRESHOLD, VICTORY_DENIAL_INDIVIDUAL_THRESHOLD, and STEAMROLL_CITY_GAP_MULTIPLIER are experimental tuning parameters subject to frequent change during balance testing. Do not flag changes to these values as issues or compare them against previous values.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-10-20T11:02:16.969Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:57-57
Timestamp: 2025-10-20T11:02:16.969Z
Learning: In src/core/execution/FakeHumanExecution.ts, the correct MIRV victory denial thresholds are VICTORY_DENIAL_TEAM_THRESHOLD = 0.8 (80% for team games) and VICTORY_DENIAL_INDIVIDUAL_THRESHOLD = 0.65 (65% for individual players), not 0.85 and 0.7 as might be mentioned in some documentation.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: For the window close confirmation feature in `ClientGameRunner.ts`, the troop count requirement (>10,000 troops) from issue #2137 was intentionally removed because it was arbitrary and troop count can be reported as low despite having significant land. The confirmation now triggers for any alive player regardless of troop count.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-05-31T18:15:03.445Z
Learnt from: 1brucben
Repo: openfrontio/OpenFrontIO PR: 977
File: src/core/execution/AttackExecution.ts:123-125
Timestamp: 2025-05-31T18:15:03.445Z
Learning: The removeTroops function in PlayerImpl.ts already prevents negative troop counts by using minInt(this._troops, toInt(troops)) to ensure it never removes more troops than available.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-08-12T00:31:50.144Z
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 1752
File: src/core/game/Game.ts:750-752
Timestamp: 2025-08-12T00:31:50.144Z
Learning: In the OpenFrontIO codebase, changes to the PlayerInteraction interface (like adding canDonateGold and canDonateTroops flags) do not require corresponding updates to src/core/Schemas.ts or server serialization code.

Applied to files:

  • resources/lang/en.json
🔇 Additional comments (4)
resources/lang/en.json (4)

714-714: LGTM - Trailing comma added correctly.

Valid JSON formatting change to support the new keys below.


716-717: LGTM - Trade and capture messages are clear.

Both translation keys properly use parameters and follow the established pattern for event messages.


719-719: LGTM - Pluralization format is correct.

The ICU MessageFormat pluralization syntax properly handles singular/plural forms for intercepted warheads.


720-727: LGTM - Donation and unit event messages are well structured.

All translation keys in this block:

  • Use consistent parameter naming ({troops}, {gold}, {name}, {unit}, {max})
  • Have clear, symmetrical sent/received message pairs
  • Follow proper JSON syntax
  • Match the established event message pattern

Comment thread resources/lang/en.json Resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@evanpelle evanpelle added this to the v29 milestone Jan 11, 2026

@evanpelle evanpelle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@evanpelle
evanpelle merged commit 8235da9 into openfrontio:main Jan 11, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

All UI strings should be localized

5 participants