Update i18n.js

This commit is contained in:
steve green 2024-06-16 09:02:28 +08:00 committed by GitHub
parent bba16f5263
commit 14a845836b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -112,11 +112,17 @@ export function applyLocale(root = document) {
if (localizedValue || localizedValue == '') {
$(this).attr(attributeMatch[1], localizedValue);
}
else {
console.warn(`Missing translation for '${attributeMatch[2]}'`);
}
} else { // No attribute tag, treat as 'text'
const localizedValue = localeData?.[key];
if (localizedValue || localizedValue == '') {
$(this).text(localizedValue);
}
else {
console.warn(`Missing translation for '${key}'`);
}
}
}
});