Repository navigation
Conversation
WalkthroughThis change adds new English translation keys for the unit info modal and updates the UnitInfoModal component to use these keys through a translation function, replacing previously hardcoded English strings. No logic or control flow is changed; only the user-facing text is now localized. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
resources/lang/en.json(1 hunks)src/client/graphics/layers/UnitInfoModal.ts(3 hunks)
🔇 Additional comments (6)
resources/lang/en.json (1)
405-410: LGTM! Clean translation key additions.The new translation keys follow the established naming convention and provide clear, descriptive English text for the unit info modal components.
src/client/graphics/layers/UnitInfoModal.ts (5)
3-3: Good addition of translation import.The translateText import follows the established pattern and enables internationalization support.
137-137: Correct translation implementation for modal title.Properly replaces hardcoded "Structure Info" with the translation key.
148-149: Good translation implementation for cooldown label.Properly replaces hardcoded "Cooldown" text with the translation key.
161-161: Excellent addition of translation to button title attribute.Good attention to detail in translating the title attribute for accessibility.
164-164: Correct translation implementation for close button text.Properly replaces hardcoded "Close" with the translation key.
| <strong>Type:</strong> ${translateText( | ||
| "unit_type." + this.unit.type?.().toLowerCase(), | ||
| ) ?? translateText("unit_info_modal.unit_type_unknown")} | ||
| <strong>Type:</strong> ${this.unit.type?.() ?? | ||
| translateText("unit_info_modal.unit_type_unknown")} |
There was a problem hiding this comment.
Fix duplicate and malformed unit type display code.
There are two conflicting implementations for displaying the unit type. The code has both a translated version and what appears to be leftover untranslated code.
Apply this diff to fix the duplicate code:
- <div style="margin-bottom: 4px;">
- <strong>Type:</strong> ${translateText(
- "unit_type." + this.unit.type?.().toLowerCase(),
- ) ?? translateText("unit_info_modal.unit_type_unknown")}
- <strong>Type:</strong> ${this.unit.type?.() ??
- translateText("unit_info_modal.unit_type_unknown")}
- </div>
+ <div style="margin-bottom: 4px;">
+ <strong>Type:</strong> ${translateText(
+ "unit_type." + this.unit.type?.().toLowerCase(),
+ ) ?? translateText("unit_info_modal.unit_type_unknown")}
+ </div>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <strong>Type:</strong> ${translateText( | |
| "unit_type." + this.unit.type?.().toLowerCase(), | |
| ) ?? translateText("unit_info_modal.unit_type_unknown")} | |
| <strong>Type:</strong> ${this.unit.type?.() ?? | |
| translateText("unit_info_modal.unit_type_unknown")} | |
| <div style="margin-bottom: 4px;"> | |
| <strong>Type:</strong> ${translateText( | |
| "unit_type." + this.unit.type?.().toLowerCase(), | |
| ) ?? translateText("unit_info_modal.unit_type_unknown")} | |
| </div> |
🤖 Prompt for AI Agents
In src/client/graphics/layers/UnitInfoModal.ts around lines 140 to 144, there is
duplicate and conflicting code displaying the unit type, with one translated and
one untranslated version. Remove the duplicate untranslated line and keep only
the translated unit type display using translateText with the fallback for
unknown types. Ensure the code cleanly displays the translated unit type without
redundancy.
Description:
Adding translation support for the unit info modal.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
sii