Skip to content

fix: re-render tutorial when language is changed mid-session#142

Merged
pshenok merged 2 commits intopshenok:mainfrom
chsungho:fix/tutorial-locale-update
Mar 9, 2026
Merged

fix: re-render tutorial when language is changed mid-session#142
pshenok merged 2 commits intopshenok:mainfrom
chsungho:fix/tutorial-locale-update

Conversation

@chsungho
Copy link
Copy Markdown
Contributor

@chsungho chsungho commented Mar 6, 2026

Summary

  • Convert TUTORIAL_STEPS from a static array to a getTutorialSteps() function so tutorial text is evaluated lazily at render time
  • Add localeChanged event listener to the Tutorial class so showStep() is called whenever the language changes mid-tutorial

Previously, all tutorial text was evaluated once at script load time (before the user selects a language), meaning switching languages had no effect on the tutorial popup. This fix ensures the tutorial always reflects the currently selected language.

This bug affects all language options, not just any single locale.

Test plan

  • Start a Survival game to open the tutorial
  • Switch language mid-tutorial and verify the tutorial text updates immediately
  • Verify tutorial buttons ("Next", "Skip Tutorial") also update to the selected language
  • Verify tutorial step progression still works correctly after a language switch
  • Verify other languages are unaffected when no language switch occurs

chsungho and others added 2 commits March 7, 2026 01:14
Convert TUTORIAL_STEPS from a static const array to getTutorialSteps()
function so translations are evaluated lazily at render time instead of
at file load. Also replace hardcoded 'Start Playing!' and 'Next' button
labels with i18n.t() calls.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add localeChanged event listener to Tutorial so that showStep() is
called when the language is switched mid-tutorial. Previously,
applyTranslations() only updated data-i18n elements and the tutorial
popup was not re-rendered.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pshenok pshenok self-requested a review March 9, 2026 06:24
@pshenok pshenok merged commit d8cd251 into pshenok:main Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants