Commit 9e0c4919 authored by XieZhiXiong's avatar XieZhiXiong

chore: 搬运国际化相关

parent c28dbdf9
国际化设置文案
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
const env = require('../../.projectEnv/env');
import zh_CN from './zh_CN';
import en_US from './en_US';
import ko_KR from './ko_KR';
const localeResource: {
"zh-CN": any,
"en-US": any,
"ko-KR": any,
} = {
"zh-CN": zh_CN,
"en-US": en_US,
"ko-KR": ko_KR,
}
type Language = keyof typeof localeResource;
const LANGUAGE: Language = (env.LANGUAGE ?? 'zh-CN') as Language
const languageDetector = {
type: 'languageDetector',
async: true,
detect: (cb: any) => cb(LANGUAGE),
init: () => { },
cacheUserLanguage: () => { },
};
i18n
.use(languageDetector as any)
.use(initReactI18next) // passes i18n down to react-i18next
.init({
fallbackLng: LANGUAGE,
debug: true,
resources: localeResource,
});
export default i18n
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment