Skip to content

i18n — language packs ​

Two capabilities — don't mix them up:

  1. Full UI language pack (type: "i18n"): translate the whole interface into a new language
  2. Plugin self-contained strings (locales/, available to any plugin type): translate only your own plugin

1. Full UI language pack (type: "i18n") ​

json
{
  "id": "example.i18n.japanese",
  "name": "日本語 UI 言語パック",
  "version": "1.0.0",
  "target_app_version": "0.2",
  "author": "TransBox",
  "type": "i18n",
  "language_code": "ja-JP",
  "language_name": "日本語",
  "entrypoint": "ja.json"
}
  • ja.json is a flat key-value dictionary ({"settings.title": "設定", ...}).
  • Fallback order for missing entries: en-US → zh-CN.
  • Language packs are mutually exclusive (only one UI language at a time).
  • Defaults to enabled: false.
  • Enabling it switches the UI language immediately; disabling it falls back safely.

Reference: extensions/example_i18n_japanese/.


Any plugin type (assistant / theme / tool …) may provide, in its plugin root directory:

text
my_plugin/
├── locales/
│   ├── zh-CN.json     # file name → language code
│   └── en-US.json
json
{
  "_meta": {
    "plugin_id": "community.assistant.interview_copilot",
    "code": "zh-CN",
    "name": "中文 (简体)",
    "short_label": "中"
  },
  "plugin.community.assistant.interview_copilot.name": "AI 面试答题助手",
  "plugin.community.assistant.interview_copilot.desc": "……",
  "plugin.community.assistant.interview_copilot.tab_title": "AI 面试助手",
  "copilot.title": "AI 面试答题助手",
  "copilot.stealth_shield": "防录屏保护"
}

Rules:

  • The host detects and mounts them automatically during the scan, no code required.
  • When the user switches language, entries are merged gracefully in the order target language → plugin en-US → plugin zh-CN.
  • _meta is a metadata block (plugin_id / code / name / short_label) and is not treated as a string entry.
  • Reserved prefixes plugin.<plugin_id>.name / .desc / .tab_title: the plugin's display name / description / title in the Plugin Hub list and on the settings tab follow the language.
  • All other keys (such as copilot.*) are your own namespace — use them freely.
  • Read them in QML with I18n.t("copilot.title"); the settings tab title (tab_title) responds automatically.

Never modify the host core string tables (src/transbox/ui/locales/*.json) — language packs and plugin strings are incremental overrides, not replacements.


Self-check ​

  • [ ] At least zh-CN.json and en-US.json under locales/
  • [ ] String prefixes don't collide with other plugins (use plugin.<plugin_id>.* or your own namespace)
  • [ ] Switch to the English interface: the plugin card name/description and settings-page copy all turn English, with no Chinese left over

TransBox — empowering borderless cross-language communication for everyone