Skip to content

feat(i18n): add 7 extension locales (zh-TW, ja-JP, fr-FR, it-IT, es-ES, de-DE, pt-BR) - #248

Open
iAstro wants to merge 4 commits into
Tencent:mainfrom
iAstro:feat/i18n-multi-language
Open

iAstro wants to merge 4 commits into
Tencent:mainfrom
iAstro:feat/i18n-multi-language

Conversation

@iAstro

@iAstro iAstro commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds 7 new extension UI locales and makes locale registration automatic, so shipping a future language no longer requires touching i18n.ts.

Changes

  • refactor(i18n): replace the hand-maintained resources object in i18n.ts with an import.meta.glob scan of locales/<locale>/<namespace>.json. Locale keys are sorted deterministically since multi-candidate normalization reads Object.keys(resources).
  • feat(i18n): add zh-TW, ja-JP, fr-FR, it-IT, es-ES, de-DE, pt-BR (221 keys each, common + extension namespaces). zh-TW is disambiguated from zh-CN by the existing script/region normalizer. ko-KR is unchanged.
  • Update locale-resolution.test.ts / i18n.test.ts expectations that hardcoded the previous shipped-language set.
  • Update language lists in packages/i18n/README.md, README.md, README.zh-CN.md.

Testing

  • pnpm --filter @browser-skill/i18n test — 64/64
  • pnpm ext:test — 1598/1598
  • pnpm --filter @browser-skill/extension compile — clean
  • pnpm ext:build — success (1.83MB)
  • pnpm exec biome check . — clean

Review notes

Translations were machine-drafted then human-reviewed; two mistranslations caught in review were fixed before this PR (de-DE hover, it-IT focus) along with two omitted strings (ja-JP/de-DE extensionVersion/protocolVersion).

liujian added 4 commits September 15, 2026 13:41
Replace the hand-maintained resources object in i18n.ts with an
import.meta.glob-based scan of locales/<locale>/<namespace>.json, so
adding a new language only requires dropping in resource files.
Locale keys are sorted deterministically to avoid depending on
filesystem enumeration order (multi-candidate normalization reads
Object.keys(resources)).
Add 7 new extension UI locales (221 keys each: common + extension
namespaces), picked up automatically by the import.meta.glob-based
registration in i18n.ts.

- zh-TW: Traditional Chinese, disambiguated from zh-CN by script/region
  in the existing locale normalizer.
- ja-JP, fr-FR, it-IT, es-ES, de-DE, pt-BR: new language families.

Update locale-resolution.test.ts and i18n.test.ts expectations that
hardcoded the previous shipped-language set (zh-Hant/zh-TW/zh-HK/zh-MO
now resolve to zh-TW instead of falling back to zh-CN; ja/fr/de/it/es/pt
are no longer in the unshipped-fallback examples). ko-KR is unchanged.

Update language lists in packages/i18n/README.md, README.md and
README.zh-CN.md.

Verified: i18n test (64/64), ext:test (1598/1598), extension compile,
ext:build, biome check — all green.
- ja-JP: extensionVersion/protocolVersion were left in English,
  inconsistent with the already-translated extensionProtocol/
  daemonProtocol in the same namespace.
- de-DE: same extensionVersion/protocolVersion omission; also
  hover was mistranslated as "Überfahren" (run over / collide),
  not the German UI term for mouse hover — changed to "Hover".
- it-IT: focus was translated as "Metti a fuoco" (camera focus),
  inconsistent with the adjacent blur ("Rimuovi focus", which
  correctly keeps focus as a loanword) — changed to "Attiva focus".

Verified: i18n test (64/64), ext:test (1598/1598), extension compile,
biome check — all green.
Upstream main gained a remote/authenticated browser connection feature
(PR Tencent#227, merged after this branch was created) that added 36 new
extension.json keys (popup.connection*, popup.remote*) and reworded
two existing keys (daemonPortLabel, daemonPortInfoLabel) in en-US,
zh-CN and ko-KR.

After rebasing this branch onto the updated main, the 7 new locales
added here were missing those same keys, which broke the i18n parity
test in CI ("Frontend lint, typecheck, tests, build" failing on
de-DE). Translate the 38 changed/added keys for zh-TW, ja-JP, fr-FR,
it-IT, es-ES, de-DE and pt-BR, using the already-shipped zh-CN/ko-KR
translations as terminology reference.

Verified: i18n test (64/64), ext:test (1658/1658), extension compile,
ext:build, biome check — all green.
@iAstro
iAstro force-pushed the feat/i18n-multi-language branch from d04017c to 47cf368 Compare September 15, 2026 05:53
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