Signed-off-by: kenwoodjw <blackxin55+@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: 起岚 <155608604+xiaoyaoqilan@users.noreply.github.com> Co-authored-by: Parman Mohammadalizadeh <prmma23@gmail.com> Co-authored-by: Escape0707 <tothesong@gmail.com> Co-authored-by: Xin Zhang <zhangxin@dify.ai> Co-authored-by: iridescentWen <66297467+iridescentWen@users.noreply.github.com> Co-authored-by: Bond Zhu <37842169+MRZHUH@users.noreply.github.com> Co-authored-by: KVOJJJin <jzongcode@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: 非法操作 <hjlarry@163.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com> Co-authored-by: Asuka Minato <i@asukaminato.eu.org> Co-authored-by: Chester <superdiao6@gmail.com> Co-authored-by: WH-2099 <wh2099@pm.me> Co-authored-by: Jony <619963502@qq.com> Co-authored-by: Jony <13896935+zyz619963502zyz@users.noreply.github.com> Co-authored-by: Harsh Kashyap <harsh.kashyap2001@gmail.com> Co-authored-by: Harsh Kashyap <Harsh23Kashyap@users.noreply.github.com> Co-authored-by: kenwoodjw <blackxin55+@gmail.com> Co-authored-by: csurong <csurong1@gmail.com> Co-authored-by: caosurong <surong.cao@thinkingdata.cn> Co-authored-by: Taranum Wasu <81034301+Taranum01@users.noreply.github.com> Co-authored-by: Taranum01 <50813317+Taranum01@users.noreply.github.com> Co-authored-by: Pranav Agarwal <agarwalpranav0711@gmail.com> Co-authored-by: Stephen Zhou <hi@hyoban.cc> Co-authored-by: zl86790 <marshal_li_b@163.com> Co-authored-by: QuantumGhost <obelisk.reg+git@gmail.com> Co-authored-by: yunlu.wen <yunlu.wen@dify.ai> Co-authored-by: yyh <yuanyouhuilyz@gmail.com> |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| locale-resources | ||
| client.ts | ||
| index.ts | ||
| language.ts | ||
| languages.ts | ||
| lib.client.ts | ||
| lib.server.ts | ||
| load-resource.ts | ||
| README.md | ||
| resources.ts | ||
| server.ts | ||
| settings.ts | ||
Internationalization
English JSON files under web/i18n/en-US/ are the source locale. Other locale directories must keep the same flat keys and placeholders. i18next uses keySeparator: false, so dots are part of a key rather than nested-object separators.
Owners
languages.tsis the source of truth for supported Web locales.language.tsowns locale normalization and product-specific locale mappings.resources.tsowns the typed namespace registry. File names use kebab case while namespaces use camel case, for exampleapp-debug.jsonandappDebug.locale-resources/<locale>.tsowns lazy loading for one locale.settings.tsowns shared i18next options.web/scripts/check-i18n.jsowns locale key validation and removal of extra keys.
Do not copy the language registry into documentation. Read the current source files when adding a locale or namespace.
Add a locale
- Add the locale metadata to
languages.ts. - Add a matching
web/i18n/<locale>/directory with every source namespace. - Add
locale-resources/<locale>.tsand the required mappings inlanguage.ts. - Keep the backend language and timezone registry in
api/constants/languages.pyaligned when the locale is accepted by backend APIs. - Run the complete i18n check before submitting the change.
LanguagesSupported is populated from the supported entries in languages.ts. language.ts also owns the accepted locale spellings and the I18nText contract; keep them aligned when adding a locale.
Add or change copy
Add or change the English key first, then update every supported locale. Preserve interpolation variables and markup placeholders exactly.
Run from web/:
pnpm i18n:check
pnpm i18n:check --file app billing --lang zh-Hans ja-JP
Arguments after --file and --lang are space-separated. Use --auto-remove only when intentionally deleting extra locale keys.
Automated translation
Changes to web/i18n/en-US/*.json on main trigger the scoped translation workflow. The workflow derives target locales from languages.ts, translates only the changed namespaces and keys, verifies them with i18n:check, and opens a pull request when translations change.
Use the Translate i18n Files with Claude Code workflow dispatch for a manual scoped sync. Full mode requires an explicit file list.