mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-08 13:39:53 +00:00
chore: abstract resources configure
This commit is contained in:
parent
fcc0dd93fd
commit
1e2d8fa027
@ -2,24 +2,13 @@ import i18n from 'i18next';
|
|||||||
import { initReactI18next } from 'react-i18next';
|
import { initReactI18next } from 'react-i18next';
|
||||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||||
|
|
||||||
import zh from './locales/zh.json'
|
import resources from './locales'
|
||||||
import en from './locales/en.json'
|
|
||||||
|
|
||||||
|
|
||||||
i18n
|
i18n
|
||||||
.use(LanguageDetector)
|
.use(LanguageDetector)
|
||||||
.use(initReactI18next)
|
.use(initReactI18next)
|
||||||
.init({
|
.init({
|
||||||
resources: {
|
resources,
|
||||||
zh: {
|
|
||||||
name: '简体中文',
|
|
||||||
translation: zh
|
|
||||||
},
|
|
||||||
en: {
|
|
||||||
name: 'English',
|
|
||||||
translation: en
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fallbackLng: 'zh',
|
fallbackLng: 'zh',
|
||||||
debug: true,
|
debug: true,
|
||||||
interpolation: {
|
interpolation: {
|
||||||
|
17
ui/src/i18n/locales/index.ts
Normal file
17
ui/src/i18n/locales/index.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { Resource } from 'i18next'
|
||||||
|
|
||||||
|
import zh from './zh.json'
|
||||||
|
import en from './en.json'
|
||||||
|
|
||||||
|
const resources: Resource = {
|
||||||
|
zh: {
|
||||||
|
name: '简体中文',
|
||||||
|
translation: zh
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
name: 'English',
|
||||||
|
translation: en
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default resources;
|
Loading…
x
Reference in New Issue
Block a user