feat: init repo
This commit is contained in:
commit
e85d11b83d
40 changed files with 6839 additions and 0 deletions
78
src/i18n/index.ts
Normal file
78
src/i18n/index.ts
Normal file
|
@ -0,0 +1,78 @@
|
|||
import i18n from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||
|
||||
// 导入翻译文件
|
||||
import zhCNTranslation from '../../data/zh-CN/index.json';
|
||||
import zhTWTranslation from '../../data/zh-TW/index.json';
|
||||
import enUSTranslation from '../../data/en-US/index.json';
|
||||
|
||||
// 导入数据文件
|
||||
import zhCNAbout from '../../data/zh-CN/about.json';
|
||||
import zhCNProjects from '../../data/zh-CN/projects.json';
|
||||
import zhCNContributors from '../../data/zh-CN/contributors.json';
|
||||
import zhCNUpdates from '../../data/zh-CN/updates.json';
|
||||
|
||||
import zhTWAbout from '../../data/zh-TW/about.json';
|
||||
import zhTWProjects from '../../data/zh-TW/projects.json';
|
||||
import zhTWContributors from '../../data/zh-TW/contributors.json';
|
||||
import zhTWUpdates from '../../data/zh-TW/updates.json';
|
||||
|
||||
import enUSAbout from '../../data/en-US/about.json';
|
||||
import enUSProjects from '../../data/en-US/projects.json';
|
||||
import enUSContributors from '../../data/en-US/contributors.json';
|
||||
import enUSUpdates from '../../data/en-US/updates.json';
|
||||
|
||||
i18n
|
||||
.use(LanguageDetector)
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
resources: {
|
||||
'zh-CN': {
|
||||
translation: zhCNTranslation.translation
|
||||
},
|
||||
'zh-TW': {
|
||||
translation: zhTWTranslation.translation
|
||||
},
|
||||
'en-US': {
|
||||
translation: enUSTranslation.translation
|
||||
}
|
||||
},
|
||||
fallbackLng: 'zh-CN',
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
react: {
|
||||
useSuspense: false
|
||||
}
|
||||
});
|
||||
|
||||
// 添加数据命名空间
|
||||
i18n.addResourceBundle('zh-CN', 'translation', {
|
||||
data: {
|
||||
about: zhCNAbout,
|
||||
projects: zhCNProjects,
|
||||
contributors: zhCNContributors,
|
||||
updates: zhCNUpdates
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
i18n.addResourceBundle('zh-TW', 'translation', {
|
||||
data: {
|
||||
about: zhTWAbout,
|
||||
projects: zhTWProjects,
|
||||
contributors: zhTWContributors,
|
||||
updates: zhTWUpdates
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
i18n.addResourceBundle('en-US', 'translation', {
|
||||
data: {
|
||||
about: enUSAbout,
|
||||
projects: enUSProjects,
|
||||
contributors: enUSContributors,
|
||||
updates: enUSUpdates
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
export default i18n;
|
Loading…
Add table
Add a link
Reference in a new issue