feat: suport more locale config

This commit is contained in:
liujuping 2023-09-25 18:09:57 +08:00 committed by 林熠
parent 7a40aff277
commit 4728484e7e

View File

@ -9,10 +9,10 @@ const instance: Record<string, Record<string, string>> = {
export function createIntl(locale: string = 'zh-CN') {
const intl = (id: string) => {
return instance[locale][id];
return instance[locale]?.[id] || id;
};
const intlNode = (id: string) => createElement('span', instance[locale][id]);
const intlNode = (id: string) => createElement('span', instance[locale]?.[id] || id);
return {
intl,