feat: add frontend internationalization foundation / 添加前端国际化基础 - #9898
Open
wanxinlei1 wants to merge 1 commit into
Open
feat: add frontend internationalization foundation / 添加前端国际化基础#9898wanxinlei1 wants to merge 1 commit into
wanxinlei1 wants to merge 1 commit into
Conversation
Initialize shared i18next resources with English fallback and Simplified Chinese browser detection. Add an Account Settings language selector, persist explicit choices locally, and migrate the application navigation as the representative shell surface. Acceptance criteria: - Selecting Simplified Chinese updates the migrated UI without a reload. - Explicit language choices survive page reloads. - Unsupported locales and missing keys fall back to English. - Interpolation, pluralization, persistence, and the browser flow are covered by tests. Refs HumanSignal#9878
👷 Deploy request for heartex-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for label-studio-docs-new-theme pending review.Visit the deploys page to approve it
|
✅ Deploy Preview for label-studio-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for label-studio-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
概要 / Summary
i18next/react-i18next初始化层,以英语作为标准回退语言,并以简体中文(zh-CN)作为首个验证语言。Add a shared
i18next/react-i18nextinitialization layer with English as the canonical fallback and Simplified Chinese (zh-CN) as the first validation locale.localStorage,并在账户设置中提供语言选择器。Detect supported browser locales, persist explicit choices in
localStorage, and expose the language selector in Account Settings.Migrate application navigation and version notifications as the representative shell surface.
Document locale contribution conventions and add unit plus end-to-end coverage.
本 PR 有意不包含 Editor、Data Manager、Django 模板及大范围字符串迁移,以保持基础实现渐进且易于评审。
This PR intentionally keeps Editor, Data Manager, Django templates, and broad string migration out of scope so the foundation remains incremental and reviewable.
验收标准 / Acceptance criteria
When no preference is saved, detect a supported browser locale and fall back to English for unsupported locales.
When Simplified Chinese is selected, update the migrated shell without a page reload.
When the page is reloaded, retain the explicit language choice.
When a localized key is missing, render the English value.
Cover interpolation, pluralization, locale matching, persistence, and the browser flow with automated tests.
测试计划 / Test plan
bun test libs/app-common/src/i18n/i18n.test.ts libs/app-common/src/pages/AccountSettings/sections/Language/Language.test.tsx libs/app-common/src/pages/AccountSettings/sections/index.test.tsx— 11 项通过 / 11 passedbunx tsc --noEmit -p libs/app-common/tsconfig.jsonbunx tsc --noEmit -p apps/labelstudio/tsconfig.jsonbunx tsc --noEmit -p apps/labelstudio-e2e/tsconfig.jsonbun run build:dev— 转换 11,147 个模块 / 11,147 modules transformedCypress 15.13.0 against a real Django 5.1.15 backend: 1 test passed, covering login, language switching, immediate navigation translation, persistence, and reload.
git diff --check关联 / Related to #9878.