基于vue3.0和element-plus的组件库
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
import { createI18n } from 'vue3-i18n';
|
|
|
|
|
import Zh from './zh';
|
|
|
|
|
import En from './en';
|
|
|
|
|
|
|
|
|
|
const messages = {
|
|
|
|
|
zh: new Zh(),
|
|
|
|
|
en: new En(),
|
|
|
|
|
};
|
|
|
|
|
const i18n = createI18n({
|
|
|
|
|
locale: 'zh',
|
|
|
|
|
messages,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const registerLang = (name, data) => {
|
|
|
|
|
messages[name] = data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export { i18n, Zh, En, registerLang };
|
|
|
|
|
|
|
|
|
|
export const createt = (sufix: string) => {
|
|
|
|
|
return (key: string): string => {
|
|
|
|
|
key = sufix + key;
|
|
|
|
|
return i18n.t(key);
|
|
|
|
|
};
|
|
|
|
|
};
|