Fixed: Loading Sonarr on OAF browsers

Closes #5363
This commit is contained in:
Mark McDowall 2023-01-11 17:09:25 -08:00
parent 4b4301a076
commit 2c5b9e9999
1 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import createAjaxRequest from 'Utilities/createAjaxRequest'; import createAjaxRequest from 'Utilities/createAjaxRequest';
function getTranslations() { function getLanguage() {
return createAjaxRequest({ return createAjaxRequest({
global: false, global: false,
dataType: 'json', dataType: 'json',
@ -8,10 +8,16 @@ function getTranslations() {
}).request; }).request;
} }
let languageNames = new Intl.DisplayNames(['en'], { type: 'language' }); function getDisplayName(code) {
return Intl.DisplayNames ?
new Intl.DisplayNames([code], { type: 'language' }) :
null;
}
getTranslations().then((data) => { let languageNames = getDisplayName('en');
const names = new Intl.DisplayNames([data.identifier], { type: 'language' });
getLanguage().then((data) => {
const names = getDisplayName(data.identifier);
if (names) { if (names) {
languageNames = names; languageNames = names;