Skip to content

fix: Fix quiz locale matching for zh-CN#1843

Open
LHN012 wants to merge 1 commit into
microsoft:mainfrom
LHN012:fix-quiz-zh-cn-locale
Open

fix: Fix quiz locale matching for zh-CN#1843
LHN012 wants to merge 1 commit into
microsoft:mainfrom
LHN012:fix-quiz-zh-cn-locale

Conversation

@LHN012

@LHN012 LHN012 commented Jun 29, 2026

Copy link
Copy Markdown

Description

This fixes Simplified Chinese quiz loading in the quiz app.

The app has a Simplified Chinese translation key named zh_cn, but browsers usually report the locale as zh-CN. Because the app compared the raw locale with locale.startsWith(key), zh-CN did not match zh_cn.

This change normalizes locale values by lowercasing and replacing - with _. It also lets the loc query parameter choose the quiz translation before the quiz file is selected.

Fixes no linked issue.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Tested

  • npm run build
  • http://localhost:5173/?loc=zh_cn shows the Chinese quiz list
  • http://localhost:5173/quiz/1?loc=zh_cn shows Lesson 1 pre-lecture quiz in Chinese
  • Clicking the correct first answer advances to the second question

@LHN012

LHN012 commented Jul 7, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

1 participant