Skip to content

Move hardcoded Adventure Mode strings to language files - #11619

Open
churrufli wants to merge 13 commits into
Card-Forge:masterfrom
churrufli:adventure-mode-string-localization
Open

Move hardcoded Adventure Mode strings to language files#11619
churrufli wants to merge 13 commits into
Card-Forge:masterfrom
churrufli:adventure-mode-string-localization

Conversation

@churrufli

Copy link
Copy Markdown
Contributor

Some UI strings were still hardcoded in Java. This moves them into the .properties files, following the same pattern used elsewhere in the module.

Added all keys to en-US.properties.
Added Spanish translations to es-ES.properties.
Added the English text as placeholders to the other 8 languages.
No behavior changes apart from the new Spanish translations.

This only covers strings that was hardcoded in Java. The larger amount of narrative text in res/adventure/ is a huge separate task.

@churrufli churrufli added the Adventure For the Adventure Module label Aug 14, 2026
Comment on lines +467 to +481
modeSummary.name = Forge.getLocalizer().getMessage("lblSummary");

StringBuilder summaryText = new StringBuilder();
switch (selectedMode) {
case Standard:
summaryText.append("Mode: Standard\n\nYour starting deck is built from 2-3 Jumpstart packs of twenty cards each.\n\n");
summaryText.append(Forge.getLocalizer().getMessage("advModeStandardSummary"));
switch (selectedDifficulty.name) {
case "Easy":
summaryText.append("On your currently selected difficulty, Easy, you will receive three jumpstart packs of your chosen color.");
summaryText.append(Forge.getLocalizer().getMessage("advDiffEasyStandard"));
break;
case "Normal":
summaryText.append("On your currently selected difficulty, Normal, you will receive two jumpstart packs of your chosen color and one of an allied color.");
summaryText.append(Forge.getLocalizer().getMessage("advDiffNormalStandard"));
break;
case "Hard":
summaryText.append("On your currently selected difficulty, Hard, you will receive one jumpstart pack of your chosen color and one of an allied color.");
summaryText.append(Forge.getLocalizer().getMessage("advDiffHardStandard"));

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.

In long methods that need many localizer calls, I'd suggest calling Forge.getLocalizer() once and stashing it in a variable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, I’ll take a look at it (next week, I’m on vacation right now). Thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed the review comment about calling Forge.getLocalizer() once and reusing the reference in methods with many localizer calls.

Applied this pattern to every method in this PR's diff that had 3+ calls to Forge.getLocalizer():

  • NewGameScene.showModeHelp() (30 calls)
  • SettingsScene constructor (57 calls), copyNewPlane() (4), restartForge() (3)
  • AdventureQuestController.getQuestNPCResponse() (6), randomItemName() (10)
  • DuelScene.enter() (5), showAnteCardPopup() (3)
  • EventScene constructor (3)
  • AdventureEventData.getDescription() (4)

Each of these now declares Localizer localizer = Forge.getLocalizer(); once at the top of the method and reuses localizer for all subsequent .getMessage(...) calls. No behavior changes, added the forge.util.Localizer import where needed. Left one-off/two-off calls elsewhere untouched since the pattern doesn't add much value there.

@churrufli
churrufli requested a review from Jetz72 August 23, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Adventure For the Adventure Module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants