feat: migrate language code
All checks were successful
Deploy / Deploy (push) Successful in 1m15s

This commit is contained in:
CDN 2025-02-03 22:52:56 +08:00
parent 47cf6171c5
commit 9ac43ef4f9
Signed by: CDN
GPG key ID: 0C656827F9F80080
86 changed files with 119 additions and 80 deletions

View file

@ -3,42 +3,42 @@ 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 zhHansTranslation from '../../data/zh-Hans/index.json';
import zhHantTranslation from '../../data/zh-Hant/index.json';
import enTranslation from '../../data/en/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 zhHansAbout from '../../data/zh-Hans/about.json';
import zhHansProjects from '../../data/zh-Hans/projects.json';
import zhHansContributors from '../../data/zh-Hans/contributors.json';
import zhHansUpdates from '../../data/zh-Hans/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 zhHantAbout from '../../data/zh-Hant/about.json';
import zhHantProjects from '../../data/zh-Hant/projects.json';
import zhHantContributors from '../../data/zh-Hant/contributors.json';
import zhHantUpdates from '../../data/zh-Hant/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';
import enAbout from '../../data/en/about.json';
import enProjects from '../../data/en/projects.json';
import enContributors from '../../data/en/contributors.json';
import enUpdates from '../../data/en/updates.json';
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources: {
'zh-CN': {
translation: zhCNTranslation.translation
'zh-Hans': {
translation: zhHansTranslation.translation
},
'zh-TW': {
translation: zhTWTranslation.translation
'zh-Hant': {
translation: zhHantTranslation.translation
},
'en-US': {
translation: enUSTranslation.translation
'en': {
translation: enTranslation.translation
}
},
fallbackLng: 'zh-CN',
fallbackLng: 'zh-Hans',
interpolation: {
escapeValue: false,
},
@ -48,30 +48,30 @@ i18n
});
// 添加数据命名空间
i18n.addResourceBundle('zh-CN', 'translation', {
i18n.addResourceBundle('zh-Hans', 'translation', {
data: {
about: zhCNAbout,
projects: zhCNProjects,
contributors: zhCNContributors,
updates: zhCNUpdates
about: zhHansAbout,
projects: zhHansProjects,
contributors: zhHansContributors,
updates: zhHansUpdates
}
}, true, true);
i18n.addResourceBundle('zh-TW', 'translation', {
i18n.addResourceBundle('zh-Hant', 'translation', {
data: {
about: zhTWAbout,
projects: zhTWProjects,
contributors: zhTWContributors,
updates: zhTWUpdates
about: zhHantAbout,
projects: zhHantProjects,
contributors: zhHantContributors,
updates: zhHantUpdates
}
}, true, true);
i18n.addResourceBundle('en-US', 'translation', {
i18n.addResourceBundle('en', 'translation', {
data: {
about: enUSAbout,
projects: enUSProjects,
contributors: enUSContributors,
updates: enUSUpdates
about: enAbout,
projects: enProjects,
contributors: enContributors,
updates: enUpdates
}
}, true, true);