Skip to content

feat: add frontend internationalization foundation / 添加前端国际化基础 - #9898

Open
wanxinlei1 wants to merge 1 commit into
HumanSignal:developfrom
wanxinlei1:codex/issue-9878-i18n-foundation
Open

feat: add frontend internationalization foundation / 添加前端国际化基础#9898
wanxinlei1 wants to merge 1 commit into
HumanSignal:developfrom
wanxinlei1:codex/issue-9878-i18n-foundation

Conversation

@wanxinlei1

@wanxinlei1 wanxinlei1 commented Aug 16, 2026

Copy link
Copy Markdown

概要 / Summary

  • 增加共享的 i18next / react-i18next 初始化层,以英语作为标准回退语言,并以简体中文(zh-CN)作为首个验证语言。
    Add a shared i18next / react-i18next initialization 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 passed
  • bunx tsc --noEmit -p libs/app-common/tsconfig.json
  • bunx tsc --noEmit -p apps/labelstudio/tsconfig.json
  • bunx tsc --noEmit -p apps/labelstudio-e2e/tsconfig.json
  • bun run build:dev — 转换 11,147 个模块 / 11,147 modules transformed
  • 在真实 Django 5.1.15 后端上运行 Cypress 15.13.0:1 项测试通过,覆盖登录、语言切换、导航即时翻译、偏好持久化和刷新。
    Cypress 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.

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
@netlify

netlify Bot commented Aug 16, 2026

Copy link
Copy Markdown

👷 Deploy request for heartex-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit f492bfc

@netlify

netlify Bot commented Aug 16, 2026

Copy link
Copy Markdown

👷 Deploy request for label-studio-docs-new-theme pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit f492bfc

@netlify

netlify Bot commented Aug 16, 2026

Copy link
Copy Markdown

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit f492bfc
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/6a8145deb7cc0b0008c99f48
😎 Deploy Preview https://deploy-preview-9898--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Aug 16, 2026

Copy link
Copy Markdown

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit f492bfc
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/6a8145de310a140008a4be2e
😎 Deploy Preview https://deploy-preview-9898--label-studio-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the feat label Aug 16, 2026
@wanxinlei1 wanxinlei1 changed the title feat: add frontend internationalization foundation feat: add frontend internationalization foundation / 添加前端国际化基础 Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant