-
Notifications
You must be signed in to change notification settings - Fork 15
/
lang.js
54 lines (50 loc) · 846 Bytes
/
lang.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function isChineseLang() {
const lang = navigator.language || navigator.userLanguage;
return lang.indexOf('zh') !== -1
}
const useEnglish = !isChineseLang()
const _lang = {
curSet: {
en: 'Current setting',
zh: '当前设定'
},
roleKeywords: {
en: 'role keywords',
zh: '角色关键字'
},
resetThread: {
en: 'Reset Thread',
zh: '重置会话'
},
mode: {
en: 'Mode',
zh: '模式'
},
light: {
en: 'Light',
zh: '浅色'
},
dark: {
en: 'Dark',
zh: '深色'
},
setAPI: {
en: 'Set API',
zh: '设置 API'
},
version: {
en: 'version',
zh: '版本号'
}
}
const lang = new Proxy(_lang, {
get: function(target, prop) {
if (target[prop]) {
return useEnglish ? target[prop].en : target[prop].zh;
}
}
});
export {
lang,
useEnglish
}