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 loadRemoteI18n = async (option: any) => {
const name = option.lang.replace('-', '_') 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` const url = `${path}/i18n/custom_${name}_front_${option.name}.js`
return await import(url) return await import(url)
} }

@ -1 +1 @@
Subproject commit af394f2d3a12de818c7a97c0f9c7989cd14fcabc Subproject commit feab899f0f951256b53eeff612d18427be358bed