mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-17 01:06:37 +08:00
feat: refactor i18n setup to use local translation files and remove backend dependency
This commit is contained in:
parent
c81ee68dd0
commit
ca334a5502
@ -7,7 +7,6 @@
|
||||
"history": "^5.3.0",
|
||||
"i18next": "^24.2.2",
|
||||
"i18next-browser-languagedetector": "^8.0.2",
|
||||
"i18next-http-backend": "^3.0.2",
|
||||
"marked": "^4.1.1",
|
||||
"moment": "^2.30.1",
|
||||
"react": "^18.2.0",
|
||||
|
@ -1,10 +1,10 @@
|
||||
import i18n from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
import Backend from 'i18next-http-backend';
|
||||
import {initReactI18next} from 'react-i18next';
|
||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||
import zhTranslation from './locales/zh/translation.json';
|
||||
import enTranslation from './locales/en/translation.json';
|
||||
|
||||
i18n
|
||||
.use(Backend)
|
||||
.use(LanguageDetector)
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
@ -15,9 +15,14 @@ i18n
|
||||
escapeValue: false,
|
||||
},
|
||||
|
||||
backend: {
|
||||
loadPath: '/locales/{{lng}}/{{ns}}.json',
|
||||
},
|
||||
resources: {
|
||||
zh: {
|
||||
translation: zhTranslation
|
||||
},
|
||||
en: {
|
||||
translation: enTranslation
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default i18n;
|
||||
|
Loading…
Reference in New Issue
Block a user