Fix/3991 Embedded i18n tokens in mixed UI text#4144
Open
wdqin wants to merge 2 commits intohalogenandtoast:mainfrom
Open
Fix/3991 Embedded i18n tokens in mixed UI text#4144wdqin wants to merge 2 commits intohalogenandtoast:mainfrom
wdqin wants to merge 2 commits intohalogenandtoast:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
"$label.doNotTakeDamage"were translated correctly"Pay $label.doNotTakeDamage"were not translated$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.DONOTTAKEDAMAGEin the UI after the raw token passed through existing uppercase styling.Change:
handleEmbeddedI18ninfrontend/src/arkham/i18n.tshandleI18nbehavior for strings that are entirely an i18n token$label.doNotTakeDamageinside otherwise plain textfrontend/src/arkham/components/GameMessage.vueto usehandleEmbeddedI18nfrontend/src/arkham/views/Game.vueto usehandleEmbeddedI18nfrontend/src/arkham/components/Question.vueto usehandleEmbeddedI18nfrontend/src/arkham/components/ChoiceModal.vueto usehandleEmbeddedI18nChoiceModal.vueso the existing.label.->.title.lookup logic still worksfrontend/src/arkham/components/QuestionChoices.vueto usehandleEmbeddedI18nfrontend/src/arkham/components/StoryQuestion.vueto usehandleEmbeddedI18nfrontend/src/components/DropDown.vueto usehandleEmbeddedI18nFiles changed:
frontend/src/arkham/i18n.tsfrontend/src/arkham/components/GameMessage.vuefrontend/src/arkham/views/Game.vuefrontend/src/arkham/components/Question.vuefrontend/src/arkham/components/ChoiceModal.vuefrontend/src/arkham/components/QuestionChoices.vuefrontend/src/arkham/components/StoryQuestion.vuefrontend/src/components/DropDown.vueTest coverage:
Added regression coverage in the rendering paths for:
Pay $label.doNotTakeDamagerendering localized textValidation:
Ran:
cd frontend && npm run tcResult:

"1 ACTION, $LABEL.DONOTTAKEDAMAGE" has been replaced with "1 ACTION, DO NOT TAKE DAMAGE"