mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
globalization fix
This commit is contained in:
parent
64354206a0
commit
ac5697b240
8 changed files with 47 additions and 35 deletions
|
@ -35,6 +35,22 @@
|
|||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', requestUrl, true);
|
||||
|
||||
var onError = function () {
|
||||
|
||||
Logger.log('Dictionary not found. Reverting to english');
|
||||
|
||||
// Grab the english version
|
||||
var xhr2 = new XMLHttpRequest();
|
||||
xhr2.open('GET', getUrl(name, 'en-US'), true);
|
||||
|
||||
xhr2.onload = function (e) {
|
||||
dictionaries[url] = JSON.parse(this.response);
|
||||
resolve();
|
||||
};
|
||||
|
||||
xhr2.send();
|
||||
};
|
||||
|
||||
xhr.onload = function (e) {
|
||||
|
||||
Logger.log('Globalize response status: ' + this.status);
|
||||
|
@ -45,20 +61,12 @@
|
|||
resolve();
|
||||
|
||||
} else {
|
||||
|
||||
// Grab the english version
|
||||
var xhr2 = new XMLHttpRequest();
|
||||
xhr2.open('GET', getUrl(name, 'en-US'), true);
|
||||
|
||||
xhr2.onload = function (e) {
|
||||
dictionaries[url] = JSON.parse(this.response);
|
||||
resolve();
|
||||
};
|
||||
|
||||
xhr2.send();
|
||||
onError();
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = onError;
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +75,6 @@
|
|||
function setCulture(value) {
|
||||
|
||||
Logger.log('Setting culture to ' + value);
|
||||
|
||||
currentCulture = value;
|
||||
|
||||
return Promise.all([loadDictionary('html', value), loadDictionary('javascript', value)]);
|
||||
|
@ -115,14 +122,11 @@
|
|||
|
||||
Logger.log('Entering Globalize.ensure');
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
return getDeviceCulture().then(function (culture) {
|
||||
|
||||
getDeviceCulture().then(function (culture) {
|
||||
culture = normalizeLocaleName(culture || 'en-US');
|
||||
|
||||
culture = normalizeLocaleName(culture || 'en-US');
|
||||
|
||||
setCulture(culture).then(resolve);
|
||||
});
|
||||
return setCulture(culture);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue