feat: i18n
parent
1ed31c1acf
commit
d3e1c81a1f
@ -0,0 +1,21 @@
|
|||||||
|
import i18next from 'i18next';
|
||||||
|
import en from './locales/en.json';
|
||||||
|
import zh from './locales/zh.json';
|
||||||
|
|
||||||
|
const lang = ['zh', 'zh-CN', 'zh-TW'].includes(navigator.language) ? 'zh' : 'en';
|
||||||
|
i18next.init({
|
||||||
|
lng: lang,
|
||||||
|
resources: {
|
||||||
|
en: {
|
||||||
|
translation: en,
|
||||||
|
},
|
||||||
|
zh: {
|
||||||
|
translation: zh,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll('.i18n').forEach((el) => {
|
||||||
|
const key = el.getAttribute('data-i18n')!;
|
||||||
|
el.textContent = i18next.t(key);
|
||||||
|
});
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"title": "BlueArchive-Style Logo Generater",
|
||||||
|
"save": "SAVE",
|
||||||
|
"copy": "COPY"
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"title": "碧蓝档案风 logo 生成器",
|
||||||
|
"save": "保存",
|
||||||
|
"copy": "复制"
|
||||||
|
}
|
Loading…
Reference in New Issue