dashboard-nanobot/frontend/src/i18n
mula.liu 413a7d6efb v 0.1.3 2026-03-03 14:09:11 +08:00
..
README.md v0.1.1 2026-03-02 00:26:03 +08:00
app.en.ts v0.1.1 2026-03-02 00:26:03 +08:00
app.zh-cn.ts v0.1.1 2026-03-02 00:26:03 +08:00
bots-sync.en.ts v0.1.1 2026-03-02 00:26:03 +08:00
bots-sync.zh-cn.ts v0.1.1 2026-03-02 00:26:03 +08:00
channels.en.ts v0.1.1 2026-03-02 00:26:03 +08:00
channels.zh-cn.ts v0.1.1 2026-03-02 00:26:03 +08:00
dashboard.en.ts v 0.1.3 2026-03-03 14:09:11 +08:00
dashboard.zh-cn.ts v 0.1.3 2026-03-03 14:09:11 +08:00
image-factory.en.ts v0.1.1 2026-03-02 00:26:03 +08:00
image-factory.zh-cn.ts v0.1.1 2026-03-02 00:26:03 +08:00
index.ts v0.1.1 2026-03-02 00:26:03 +08:00
legacy-deck.en.ts v0.1.1 2026-03-02 00:26:03 +08:00
legacy-deck.zh-cn.ts v0.1.1 2026-03-02 00:26:03 +08:00
management.en.ts v0.1.1 2026-03-02 00:26:03 +08:00
management.zh-cn.ts v0.1.1 2026-03-02 00:26:03 +08:00
wizard.en.ts v0.1.1 2026-03-02 00:26:03 +08:00
wizard.zh-cn.ts v0.1.1 2026-03-02 00:26:03 +08:00

README.md

I18N Convention

Use this convention for every new page/module:

  1. Add two language packs in this folder:
  • <module>.zh-cn.ts
  • <module>.en.ts
  1. Export plain objects/functions from both files with the same key shape.

  2. In component code, select pack via:

import { pickLocale } from '../i18n';
import { xxxZhCn } from '../i18n/xxx.zh-cn';
import { xxxEn } from '../i18n/xxx.en';

const t = pickLocale(locale, { 'zh-cn': xxxZhCn, en: xxxEn });
  1. Do not add inline isZh ? ... : ... strings in page code.

  2. Keep dynamic text in translation pack as small helper functions.