feat: 初始化
This commit is contained in:
32
locale/index.ts
Normal file
32
locale/index.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import arSA from './ar-SA.json';
|
||||
import enUS from './en-US.json';
|
||||
import esES from './es-ES.json';
|
||||
import hiIN from './hi-IN.json';
|
||||
import inID from './in-ID.json';
|
||||
import koKR from './ko-KR.json';
|
||||
import thTH from './th-TH.json';
|
||||
import viVN from './vi-VN.json';
|
||||
import zhCN from './zh-CN.json';
|
||||
import zhTW from './zh-TW.json';
|
||||
import { locales, defaultLocale } from '@/utils/const';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
const messages = {
|
||||
'ar-SA': arSA,
|
||||
'en-US': enUS,
|
||||
en: enUS,
|
||||
'es-ES': esES,
|
||||
'hi-IN': hiIN,
|
||||
'in-ID': inID,
|
||||
'ko-KR': koKR,
|
||||
'th-TH': thTH,
|
||||
'vi-VN': viVN,
|
||||
'zh-CN': zhCN,
|
||||
'zh-TW': zhTW
|
||||
};
|
||||
const locale = uni.getLocale();
|
||||
let i18nConfig = {
|
||||
locale: locales.includes(locale) ? locale : defaultLocale,
|
||||
messages
|
||||
};
|
||||
const i18n = createI18n(i18nConfig);
|
||||
export { messages, i18n };
|
Reference in New Issue
Block a user