-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80acdbf
commit 1ef13af
Showing
7 changed files
with
58 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
"vite": "^6.0.6", | ||
"vooks": "^0.2.12", | ||
"vue": "^3.5.13", | ||
"vue-i18n": "10", | ||
"vue-tsc": "^2.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { createI18n } from 'vue-i18n' | ||
import zhCN from './locales/zh-CN.json' | ||
|
||
const messages = { | ||
'en': Object.fromEntries(Object.keys(zhCN).map(key => [key, key])), | ||
'zh-CN': zhCN, | ||
} | ||
|
||
function getLocale() { | ||
for (const language of navigator.languages) { | ||
if (language in messages) { | ||
return language | ||
} | ||
if (language.startsWith('en')) { | ||
return 'en' | ||
} | ||
if (language === 'zh-SG') { | ||
return 'zh-CN' | ||
} | ||
} | ||
} | ||
|
||
const i18n = createI18n({ | ||
locale: getLocale(), | ||
messages, | ||
}) | ||
|
||
export function t(key: string) { | ||
return i18n.global.t(key) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"Add": "添加", | ||
"Available": "可用", | ||
"Cancel": "取消", | ||
"Download and drag zip to this area": "下载并拖拽 zip 到此区域", | ||
"Installed": "已安装", | ||
"Mozc doesn't work on Chrome unless start the process with": "Mozc 在 Chrome 下不工作,除非用如下参数启动进程", | ||
"Only show current language": "只显示当前语言", | ||
"Reset to default": "重设为默认值", | ||
"Select a language from the left list": "从左侧列表中选择一个语言", | ||
"Warning": "警告" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ export default defineConfig({ | |
'vue', | ||
'naive-ui', | ||
'vooks', | ||
'vue-i18n', | ||
], | ||
}, | ||
}, | ||
|