mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-01 11:56:48 +01:00
Skip applying translations if no locale data is loaded
This commit is contained in:
parent
c27f8462fc
commit
3912c67965
@ -81,6 +81,10 @@ async function getMissingTranslations() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function applyLocale(root = document) {
|
export function applyLocale(root = document) {
|
||||||
|
if (!localeData || Object.keys(localeData).length === 0) {
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
const $root = root instanceof Document ? $(root) : $(new DOMParser().parseFromString(root, 'text/html'));
|
const $root = root instanceof Document ? $(root) : $(new DOMParser().parseFromString(root, 'text/html'));
|
||||||
|
|
||||||
//find all the elements with `data-i18n` attribute
|
//find all the elements with `data-i18n` attribute
|
||||||
@ -112,8 +116,8 @@ export function applyLocale(root = document) {
|
|||||||
function addLanguagesToDropdown() {
|
function addLanguagesToDropdown() {
|
||||||
for (const langObj of langs) { // Set the value to the language code
|
for (const langObj of langs) { // Set the value to the language code
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = langObj["lang"]; // Set the value to the language code
|
option.value = langObj['lang']; // Set the value to the language code
|
||||||
option.innerText = langObj["display"]; // Set the display text to the language name
|
option.innerText = langObj['display']; // Set the display text to the language name
|
||||||
$('#ui_language_select').append(option);
|
$('#ui_language_select').append(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user