Set English as base language with DE fallback
This commit is contained in:
1 parent
0d5b45d663
commit
ecc3156652
3 files changed
+11
-5
No files matched your search
@@ -8,7 +8,7 @@ window.CONFIG = {
|
||||
debug: 1,
|
||||
theme: 'ash',
|
||||
units: 'metric',
|
||||
language: 'de'
|
||||
language: 'en'
|
||||
};
|
||||
|
||||
// List of available themes. The key is the theme id (used in config.theme),
|
||||
|
||||
@@ -49,10 +49,16 @@ window.TRANSLATIONS = {
|
||||
};
|
||||
|
||||
window.getTranslation = function(key) {
|
||||
var lang = (window.CONFIG && window.CONFIG.language) || 'de';
|
||||
var lang = (window.CONFIG && window.CONFIG.language) || 'en';
|
||||
var entry = window.TRANSLATIONS[key];
|
||||
if (!entry) return key;
|
||||
return entry[lang] || entry.de || key;
|
||||
// Fallback chain: requested language → 'en' → first available → key
|
||||
if (entry[lang]) return entry[lang];
|
||||
if (entry.en) return entry.en;
|
||||
for (var k in entry) {
|
||||
if (entry.hasOwnProperty(k) && entry[k]) return entry[k];
|
||||
}
|
||||
return key;
|
||||
};
|
||||
|
||||
window.t = window.getTranslation;
|
||||
+2
-2
@@ -1277,8 +1277,8 @@ window.weatherThemes = {
|
||||
];
|
||||
|
||||
var LANGUAGE_OPTIONS = [
|
||||
{ value: 'de', label: 'DE' },
|
||||
{ value: 'en', label: 'EN' }
|
||||
{ value: 'en', label: 'EN' },
|
||||
{ value: 'de', label: 'DE' }
|
||||
];
|
||||
|
||||
function applyI18n() {
|
||||
|
||||
Reference in new issue
Block a user