perf: 优化自定义国际化加载路径

This commit is contained in:
fit2cloud-chenyw
2024-12-28 19:10:36 +08:00
committed by fit2cloud-chenyw
parent d0db747cae
commit dfba990892
2 changed files with 5 additions and 2 deletions

View File

@@ -50,7 +50,10 @@ const createI18nOptions = async (): Promise<I18nOptions> => {
const loadRemoteI18n = async (option: any) => {
const name = option.lang.replace('-', '_')
const path = PATH_URL.startsWith('./') && PATH_URL.length > 2 ? PATH_URL.substring(1) : PATH_URL
const path =
PATH_URL.startsWith('./') && PATH_URL.length > 2
? window.location.pathname + PATH_URL.substring(2)
: PATH_URL
const url = `${path}/i18n/custom_${name}_front_${option.name}.js`
return await import(url)
}