1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

globalization fix

This commit is contained in:
Luke Pulverenti 2015-12-12 16:16:33 -05:00
parent 64354206a0
commit ac5697b240
8 changed files with 47 additions and 35 deletions

View file

@ -44,8 +44,7 @@
CameraUploadPath: $('#txtUploadPath', page).val()
}),
contentType: "application/json",
dataType: 'json'
contentType: "application/json"
}).then(Dashboard.processServerConfigurationUpdateResult);
}

View file

@ -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);
});
}

View file

@ -76,8 +76,12 @@
function renderForm(options) {
require(['paper-checkbox', 'paper-input'], function () {
renderFormInternal(options);
return new Promise(function (resolve, reject) {
require(['paper-checkbox', 'paper-input'], function () {
renderFormInternal(options);
resolve();
});
});
}

View file

@ -23,8 +23,9 @@
dialogOptionsFn: getTargetDialogOptionsFn(dialogOptions),
showName: true,
readOnlySyncTarget: true
}).then(function () {
fillJobValues(page, job, dialogOptions);
});
fillJobValues(page, job, dialogOptions);
}
function getTargetDialogOptionsFn(dialogOptions) {
@ -267,7 +268,11 @@
function fillJobValues(page, job, editOptions) {
$('#txtSyncJobName', page).val(job.Name);
var txtSyncJobName = page.querySelector('#txtSyncJobName');
if (txtSyncJobName) {
txtSyncJobName.value = job.Name;
}
$('#selectProfile', page).val(job.Profile || '').trigger('change');
$('#selectQuality', page).val(job.Quality || '').trigger('change');
$('#chkUnwatchedOnly', page).checked(job.UnwatchedOnly);