feat(i18n): add Traditional Chinese Taiwan and Hong Kong locales (#2558)
Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
This commit is contained in:
+17
-6
@@ -2,9 +2,13 @@
|
||||
|
||||
Kandev's web UI is internationalized with [i18next](https://www.i18next.com) +
|
||||
[react-i18next](https://react.i18next.com). English is the source locale,
|
||||
European Portuguese (`pt-pt`) and Simplified Chinese (`zh-cn`) are the shipped
|
||||
European Portuguese (`pt-pt`), Simplified Chinese (`zh-cn`), Traditional Chinese
|
||||
Taiwan (`zh-tw`), and Traditional Chinese Hong Kong (`zh-hk`) are the shipped
|
||||
human locales, and a generated **pseudo-locale** is used for QA. Requirements live in
|
||||
[`docs/specs/platform/i18n.md`](specs/platform/i18n.md).
|
||||
[`docs/specs/platform/i18n.md`](specs/platform/i18n.md). Traditional Chinese
|
||||
catalogs are derived from `zh-cn` via OpenCC plus a product glossary; see
|
||||
[`docs/specs/platform/traditional-chinese-locales.md`](specs/platform/traditional-chinese-locales.md)
|
||||
and [`docs/plans/traditional-chinese-locales/`](plans/traditional-chinese-locales/).
|
||||
|
||||
The migration is **complete**. Every routed web UI surface renders through `t()`
|
||||
/ `<Trans>`, and `i18nGuardFiles` now enumerates the directories that hold them.
|
||||
@@ -1073,14 +1077,21 @@ Do it in its own PR, not inside a copy-only migration.
|
||||
Use a canonical lowercase locale id such as `zh-cn`. Locale negotiation accepts
|
||||
case variants such as `zh-CN`, but cookies and `<html lang>` use the canonical id.
|
||||
|
||||
For Traditional Chinese Taiwan / Hong Kong specifically, prefer converting from
|
||||
`zh-cn` with `node scripts/convert-zh-cn-to-zh-hant.mjs --write` (OpenCC +
|
||||
`scripts/lib/zh-hant-glossary.json`) rather than re-translating from English.
|
||||
See `docs/plans/traditional-chinese-locales/glossary.md`.
|
||||
|
||||
1. Add the locale to `SUPPORTED_LOCALES` and give it a fixed endonym in
|
||||
`LOCALE_LABELS` in `apps/web/lib/i18n/index.ts`. Add the same id to
|
||||
`supportedLocales` in `apps/backend/internal/i18n/i18n.go`. Keep the frontend
|
||||
and backend lists synchronized.
|
||||
and backend lists synchronized. Also wire `date-locale.ts` when the locale
|
||||
needs a non-English date-fns pack.
|
||||
2. Copy every `apps/web/src/locales/en/*.json` namespace into
|
||||
`apps/web/src/locales/<locale>/`. Translate values only: never rename keys,
|
||||
plural suffixes, interpolation placeholders, `<Trans>` tags, command tokens,
|
||||
shortcuts, filenames, URLs, or brand names.
|
||||
`apps/web/src/locales/<locale>/` (or generate from `zh-cn` for Traditional
|
||||
Chinese). Translate values only: never rename keys, plural suffixes,
|
||||
interpolation placeholders, `<Trans>` tags, command tokens, shortcuts,
|
||||
filenames, URLs, or brand names.
|
||||
3. Add `apps/backend/internal/i18n/locales/<locale>.json` with exactly the same
|
||||
keys as the backend `en.json` and translate its values.
|
||||
4. Add focused frontend tests for registration, selection, activation, cookie
|
||||
|
||||
Reference in New Issue
Block a user