diff --git a/src/components/common/Setting/General.vue b/src/components/common/Setting/General.vue index 4152b4a..2516cbb 100644 --- a/src/components/common/Setting/General.vue +++ b/src/components/common/Setting/General.vue @@ -52,6 +52,7 @@ const themeOptions: { label: string; key: Theme; icon: string }[] = [ const languageOptions: { label: string; key: Language; value: Language }[] = [ { label: '中文', key: 'zh-CN', value: 'zh-CN' }, + { label: '繁體中文', key: 'zh-TW', value: 'zh-TW' }, { label: 'English', key: 'en-US', value: 'en-US' }, ] diff --git a/src/hooks/useLanguage.ts b/src/hooks/useLanguage.ts index 13b8ce9..f015142 100644 --- a/src/hooks/useLanguage.ts +++ b/src/hooks/useLanguage.ts @@ -1,5 +1,5 @@ import { computed } from 'vue' -import { enUS, zhCN } from 'naive-ui' +import { enUS, zhCN, zhTW } from 'naive-ui' import { useAppStore } from '@/store' import { setLocale } from '@/locales' @@ -14,6 +14,9 @@ export function useLanguage() { case 'zh-CN': setLocale('zh-CN') return zhCN + case 'zh-TW': + setLocale('zh-TW') + return zhTW default: setLocale('zh-CN') return enUS diff --git a/src/locales/index.ts b/src/locales/index.ts index 17d3b56..49eb488 100644 --- a/src/locales/index.ts +++ b/src/locales/index.ts @@ -1,7 +1,8 @@ import type { App } from 'vue' import { createI18n } from 'vue-i18n' -import en from './en-US' -import cn from './zh-CN' +import enUS from './en-US' +import zhCN from './zh-CN' +import zhTW from './zh-TW' import { useAppStoreWithOut } from '@/store/modules/app' import type { Language } from '@/store/modules/app/helper' @@ -14,8 +15,9 @@ const i18n = createI18n({ fallbackLocale: 'en-US', allowComposition: true, messages: { - 'en-US': en, - 'zh-CN': cn, + 'en-US': enUS, + 'zh-CN': zhCN, + 'zh-TW': zhTW, }, }) diff --git a/src/locales/zh-TW.ts b/src/locales/zh-TW.ts new file mode 100644 index 0000000..1385d95 --- /dev/null +++ b/src/locales/zh-TW.ts @@ -0,0 +1,43 @@ +export default { + common: { + delete: '刪除', + save: '儲存', + reset: '重設', + export: '導出', + import: '導入', + clear: '清空', + yes: '是', + no: '否', + noData: '暫無資料', + wrong: '好像出錯了,請稍後再試。', + success: '操作成功', + failed: '操作失敗', + }, + chat: { + placeholder: '來講點什麼...(Shift + Enter = 換行)', + placeholderMobile: '來講點什麼...', + copy: '複製', + copied: '複製成功', + copyCode: '複製代碼', + clearChat: '清空對話', + clearChatConfirm: '是否清空對話?', + deleteMessage: '刪除訊息', + deleteMessageConfirm: '是否刪除此訊息?', + deleteHistoryConfirm: '確定刪除此紀錄?', + }, + setting: { + setting: '設定', + general: '總覽', + config: '設定', + avatarLink: '頭貼連結', + name: '名稱', + description: '描述', + resetUserInfo: '重設使用者資訊', + theme: '主題', + language: '語言', + api: 'API', + reverseProxy: '反向代理', + timeout: '逾時', + socks: 'Socks', + }, +} diff --git a/src/store/modules/app/helper.ts b/src/store/modules/app/helper.ts index f94b6f6..a15b07e 100644 --- a/src/store/modules/app/helper.ts +++ b/src/store/modules/app/helper.ts @@ -4,7 +4,7 @@ const LOCAL_NAME = 'appSetting' export type Theme = 'light' | 'dark' | 'auto' -export type Language = 'zh-CN' | 'en-US' +export type Language = 'zh-CN' | 'zh-TW' | 'en-US' export interface AppState { siderCollapsed: boolean