We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6d6d25 commit 879cee6Copy full SHA for 879cee6
src/i18n.ts
@@ -1,8 +1,16 @@
1
import { createI18n } from 'vue-i18n'
2
import zhCN from './locales/zh-CN.json'
3
4
-const messages = {
5
- 'en': Object.fromEntries(Object.keys(zhCN).map(key => [key, key])),
+function replaceLeaves(object: Record<string, any>): Record<string, any> {
+ const result: Record<string, any> = {}
6
+ for (const [key, value] of Object.entries(object)) {
7
+ result[key] = typeof value === 'object' ? replaceLeaves(value) : key
8
+ }
9
+ return result
10
+}
11
+
12
+const messages: Record<string, any> = {
13
+ 'en': replaceLeaves(zhCN),
14
'zh-CN': zhCN,
15
}
16
@@ -18,6 +26,7 @@ export function getLocale(messages: { [key: string]: any }) {
18
26
return 'zh-CN'
19
27
20
28
29
+ return 'en'
21
30
22
31
23
32
const i18n = createI18n({
0 commit comments