Skip to content

Fix/3991 Embedded i18n tokens in mixed UI text#4144

Open
wdqin wants to merge 2 commits intohalogenandtoast:mainfrom
wdqin:fix/3991-odd-prompt-using-parallel-Agnes-ability
Open

Fix/3991 Embedded i18n tokens in mixed UI text#4144
wdqin wants to merge 2 commits intohalogenandtoast:mainfrom
wdqin:fix/3991-odd-prompt-using-parallel-Agnes-ability

Conversation

@wdqin
Copy link
Copy Markdown

@wdqin wdqin commented Mar 31, 2026

Title:
Fix/3991 Fix embedded i18n tokens in mixed UI text

Issue ID: 3991
#3991
Agnes Baker (Parallel) embedded i18n display bug

Summary:
This fixes frontend rendering for mixed text that contains embedded i18n tokens, such as Pay $label.doNotTakeDamage.

PLEASE NOTE THAT this fix is based on the assumption that more embedded i18n tokens are going to be a part of the card effect choice descriptions in the future. Otherwise, simply replacing "$label.doNotTakeDamage" with "DO NOT TAKE DAMAGE" is a more direct and cleaner solution.

Problem:
The frontend i18n handling was internally inconsistent:

  • whole-string i18n tokens like "$label.doNotTakeDamage" were translated correctly
  • mixed strings like "Pay $label.doNotTakeDamage" were not translated
  • the backend was already emitting the correct i18n key for Agnes Baker (Parallel)
  • but the frontend only translated strings when the entire string started with $

Because of that, mixed UI text could display raw i18n tokens instead of localized text. In Agnes Baker (Parallel), choosing not to take damage could surface $LABEL.DONOTTAKEDAMAGE in the UI after the raw token passed through existing uppercase styling.

Change:

  • Added handleEmbeddedI18n in frontend/src/arkham/i18n.ts
  • Preserved existing whole-string handleI18n behavior for strings that are entirely an i18n token
  • Added embedded-token replacement for bare tokens like $label.doNotTakeDamage inside otherwise plain text
  • Explicitly left embedded parameterized tokens unsupported in this pass
  • Changed log rendering in frontend/src/arkham/components/GameMessage.vue to use handleEmbeddedI18n
  • Changed websocket/local log formatting in frontend/src/arkham/views/Game.vue to use handleEmbeddedI18n
  • Changed question/payment label rendering in frontend/src/arkham/components/Question.vue to use handleEmbeddedI18n
  • Changed modal label rendering in frontend/src/arkham/components/ChoiceModal.vue to use handleEmbeddedI18n
  • Kept raw payment/amount labels in ChoiceModal.vue so the existing .label. -> .title. lookup logic still works
  • Changed choice rendering in frontend/src/arkham/components/QuestionChoices.vue to use handleEmbeddedI18n
  • Changed story question rendering in frontend/src/arkham/components/StoryQuestion.vue to use handleEmbeddedI18n
  • Changed dropdown option rendering in frontend/src/components/DropDown.vue to use handleEmbeddedI18n

Files changed:

  • frontend/src/arkham/i18n.ts
  • frontend/src/arkham/components/GameMessage.vue
  • frontend/src/arkham/views/Game.vue
  • frontend/src/arkham/components/Question.vue
  • frontend/src/arkham/components/ChoiceModal.vue
  • frontend/src/arkham/components/QuestionChoices.vue
  • frontend/src/arkham/components/StoryQuestion.vue
  • frontend/src/components/DropDown.vue

Test coverage:
Added regression coverage in the rendering paths for:

  • whole-string i18n tokens continuing to render exactly as before
  • mixed strings like Pay $label.doNotTakeDamage rendering localized text
  • multiple embedded bare tokens in the same string being localized
  • strings without embedded tokens remaining unchanged
  • Agnes Baker (Parallel) mixed-text display paths using the new helper

Validation:
Ran:
cd frontend && npm run tc

Result:
Screenshot 2026-03-31 at 7 00 46 PM
"1 ACTION, $LABEL.DONOTTAKEDAMAGE" has been replaced with "1 ACTION, DO NOT TAKE DAMAGE"

@wdqin wdqin changed the title Fix embedded i18n tokens in mixed UI text Fix/3991 Fix embedded i18n tokens in mixed UI text Mar 31, 2026
@wdqin wdqin changed the title Fix/3991 Fix embedded i18n tokens in mixed UI text Fix/3991 Embedded i18n tokens in mixed UI text Mar 31, 2026
@wdqin wdqin closed this Mar 31, 2026
@github-project-automation github-project-automation bot moved this from Todo to Done in Arkham Issues Mar 31, 2026
@wdqin wdqin reopened this Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant