Repository navigation
Translate displayMessage events via events_display keys - #2847
Conversation
|
|
WalkthroughThis PR localizes multiple user-facing event messages: adds new Changes
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
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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. Comment |
There was a problem hiding this comment.
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 requestedtroops.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 rawdeaths(number) to i18n instead of a pre-rendered string.
Pre-rendering (renderTroops) can make non-English formatting harder and can hide rounding differences ifdeathsis 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
📒 Files selected for processing (8)
resources/lang/en.jsonsrc/core/execution/AttackExecution.tssrc/core/execution/SAMLauncherExecution.tssrc/core/execution/SAMMissileExecution.tssrc/core/execution/TradeShipExecution.tssrc/core/execution/TransportShipExecution.tssrc/core/game/PlayerImpl.tssrc/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.tssrc/core/execution/AttackExecution.tssrc/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.tssrc/core/execution/AttackExecution.tssrc/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.tssrc/core/execution/SAMLauncherExecution.tssrc/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.tssrc/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.tssrc/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.tssrc/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_destroyedpayload 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 usesdisplayName()andname()methods, which return formatted player names. Everything works as intended.src/core/execution/SAMMissileExecution.ts (1)
63-69: The code is correct.UnitTypeenum values are display strings (e.g.,"Atom Bomb","Hydrogen Bomb"), not raw enum names. Passingthis.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, optionalgoldAmount, optionalparams), 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 themaxvalue 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 usesrenderTroops()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 bothgold(formatted withrenderNumber()) and the original owner'snameto 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 formattedgoldamount and the trading partner'sname.
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 formattedgoldamount and the destination port owner'sname.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.jsonshould be updated in this PR—other locale files will be handled by dedicated translation PRs.
|
@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. |
There was a problem hiding this comment.
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
📒 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
There was a problem hiding this comment.
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
📒 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
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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:
Please put your Discord username so you can be contacted if a bug or regression is found:
aotumuri