feat: 添加繁体中文翻译 (#348)

* feat: Add Traditional Chinese language UI locale

* chore: 添加新翻译

---------

Co-authored-by: ChenZhaoYu <790348264@qq.com>
This commit is contained in:
Peter Dave Hello 2023-03-07 18:44:27 +08:00 committed by GitHub
parent 45cbfbf002
commit ecc2afd164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 6 deletions

View File

@ -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' },
]

View File

@ -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

View File

@ -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,
},
})

43
src/locales/zh-TW.ts Normal file
View File

@ -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',
},
}

View File

@ -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