mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
parent
fccf42274a
commit
c6116c2766
1 changed files with 9 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
define(['connectionManager', 'userSettings', 'events'], function (connectionManager, userSettings, events) {
|
define(['connectionManager', 'userSettings', 'events'], function (connectionManager, userSettings, events) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var fallbackCulture = 'en-us';
|
||||||
|
|
||||||
var allTranslations = {};
|
var allTranslations = {};
|
||||||
var currentCulture;
|
var currentCulture;
|
||||||
|
@ -29,7 +30,7 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
|
||||||
return navigator.languages[0];
|
return navigator.languages[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'en-us';
|
return fallbackCulture;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCurrentCulture() {
|
function updateCurrentCulture() {
|
||||||
|
@ -62,6 +63,11 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
|
||||||
for (var i in allTranslations) {
|
for (var i in allTranslations) {
|
||||||
ensureTranslation(allTranslations[i], culture);
|
ensureTranslation(allTranslations[i], culture);
|
||||||
}
|
}
|
||||||
|
if (culture !== fallbackCulture) {
|
||||||
|
for (var i in allTranslations) {
|
||||||
|
ensureTranslation(allTranslations[i], fallbackCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ensureTranslation(translationInfo, culture) {
|
function ensureTranslation(translationInfo, culture) {
|
||||||
|
@ -138,7 +144,7 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
|
||||||
|
|
||||||
if (!filtered.length) {
|
if (!filtered.length) {
|
||||||
filtered = translations.filter(function (t) {
|
filtered = translations.filter(function (t) {
|
||||||
return normalizeLocaleName(t.lang) === 'en-us';
|
return normalizeLocaleName(t.lang) === fallbackCulture;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +192,7 @@ define(['connectionManager', 'userSettings', 'events'], function (connectionMana
|
||||||
function translateKeyFromModule(key, module) {
|
function translateKeyFromModule(key, module) {
|
||||||
var dictionary = getDictionary(module, getCurrentLocale());
|
var dictionary = getDictionary(module, getCurrentLocale());
|
||||||
if (!dictionary || !dictionary[key]) {
|
if (!dictionary || !dictionary[key]) {
|
||||||
dictionary = getDictionary(module, 'en-us');
|
dictionary = getDictionary(module, fallbackCulture);
|
||||||
}
|
}
|
||||||
if (!dictionary) {
|
if (!dictionary) {
|
||||||
return key;
|
return key;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue