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.
20 lines
501 B
20 lines
501 B
import type { SupportedLanguagesType } from '@vben/locales';
|
|
|
|
import { loadLocalesMapFromDir } from '@vben/locales';
|
|
|
|
const modules = import.meta.glob('./langs/**/*.json');
|
|
|
|
const localesMap = loadLocalesMapFromDir(
|
|
/\.\/langs\/([^/]+)\/(.*)\.json$/,
|
|
modules,
|
|
);
|
|
|
|
/**
|
|
* 加载平台服务本地化资源
|
|
* @param lang 当前语言
|
|
* @returns 资源集合
|
|
*/
|
|
export async function loadPaltformMessages(lang: SupportedLanguagesType) {
|
|
const locales = localesMap[lang]?.();
|
|
return locales;
|
|
}
|
|
|