fix: 印尼语在未更新i18nData.json的服务器上回退到en而非zh
- onMounted: 若id语言包缺失,自动使用en作为回退(而非显示中文) - t(): 默认回退语言从zh改为en(英语比中文更通用) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1237,7 +1237,7 @@
|
||||
};
|
||||
|
||||
const t = (k) => {
|
||||
const dict = i18nData.value[currentLang.value] || i18nData.value['zh'] || {};
|
||||
const dict = i18nData.value[currentLang.value] || i18nData.value['en'] || {};
|
||||
return dict[k] || k;
|
||||
};
|
||||
const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
||||
@@ -1875,6 +1875,12 @@
|
||||
const res = await fetch("/static/i18nData.json");
|
||||
i18nData.value = await res.json();
|
||||
|
||||
// Backward compat: ensure id lang pack exists on servers not yet updated
|
||||
if (!i18nData.value.id) {
|
||||
console.warn('id language pack missing, using en as fallback');
|
||||
i18nData.value.id = i18nData.value.en || {};
|
||||
}
|
||||
|
||||
// Add new missing translations for Mineru Deploy
|
||||
const extraZh = {
|
||||
mineruDeployParseMethodLabel: "解析方法 (Parse Method)",
|
||||
|
||||
Reference in New Issue
Block a user