Skip to content

Commit 692ae08

Browse files
committed
feat(i18n): 添加繁體中文語言支援
- 在語言切換下拉選單中新增繁體中文選項 - 建立繁體中文語言包檔案 (zh-TW.ts) 並完成所有UI文字翻譯- 更新i18n插件配置以支援繁體中文,包括語言類型定義和訊息載入 - 設定繁體中文的語言檢測規則,支援 zh-TW、zh-HK 及包含 Hant 的語言代碼 - 配置繁體中文的fallback規則,優先回退到簡體中文再回退到英文 - 更新README文件,新增繁體中文語言支援說明和當前支援語言列表
1 parent 34802fe commit 692ae08

File tree

4 files changed

+1393
-5
lines changed

4 files changed

+1393
-5
lines changed

packages/ui/src/components/LanguageSwitchDropdown.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ const availableLanguages: LanguageOption[] = [
7979
label: '简体中文',
8080
locale: 'zh-CN'
8181
},
82+
{
83+
key: 'zh-TW',
84+
label: '繁體中文',
85+
locale: 'zh-TW'
86+
},
8287
{
8388
key: 'en-US',
8489
label: 'English',

packages/ui/src/i18n/README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,17 @@ export default {
9696

9797
1.`locales` 目录下创建对应的语言文件,如 `ja-JP.ts`
9898
2. 复制现有语言文件的结构,确保键名完全一致
99-
3. 更新语言切换组件,添加新语言选项
100-
4. 测试所有页面在新语言下的显示效果
99+
3.`packages/ui/src/plugins/i18n.ts` 中:
100+
- 导入新语言文件
101+
- 添加到 `SupportedLocale` 类型
102+
- 添加到 `SUPPORTED_LOCALES` 数组
103+
- 配置 fallback 规则
104+
- 添加到 `messages` 对象
105+
4.`packages/ui/src/components/LanguageSwitchDropdown.vue` 中添加新语言选项
106+
5. 测试所有页面在新语言下的显示效果
107+
108+
## 当前支持的语言
109+
110+
- **简体中文 (zh-CN)**: 默认语言,适用于中国大陆用户
111+
- **繁體中文 (zh-TW)**: 适用于台湾、香港等地区用户,基于简体中文翻译并适配港台用语习惯
112+
- **English (en-US)**: 英语,适用于国际用户

0 commit comments

Comments
 (0)