Add i18n dictionary and dynamic UI translations
This commit is contained in:
1 parent
f726b76b7d
commit
d546124359
3 files changed
+89
-17
No files matched your search
@@ -0,0 +1,49 @@
|
||||
/* Internationalization dictionary
|
||||
*
|
||||
* Each key maps to an array of translations indexed by language code.
|
||||
* To add a new language, add an entry with the language code as the key
|
||||
* and translations for each existing key.
|
||||
*
|
||||
* Example:
|
||||
* TRANSLATIONS.title = { de: 'Titel', en: 'Title' };
|
||||
*
|
||||
* The current language is taken from window.CONFIG.language.
|
||||
*/
|
||||
|
||||
window.TRANSLATIONS = {
|
||||
'Aufgang': { de: 'Aufgang', en: 'Sunrise' },
|
||||
'Untergang': { de: 'Untergang', en: 'Sunset' },
|
||||
'Zenit Sonne': { de: 'Zenit Sonne', en: 'Sun Zenith' },
|
||||
'Mondphase': { de: 'Mondphase', en: 'Moon Phase' },
|
||||
'Mond auf': { de: 'Mond auf', en: 'Moonrise' },
|
||||
'Mond unter': { de: 'Mond unter', en: 'Moonset' },
|
||||
|
||||
'heute': { de: 'heute', en: 'today' },
|
||||
'morgen': { de: 'morgen', en: 'tomorrow' },
|
||||
|
||||
'Neumond': { de: 'Neumond', en: 'New Moon' },
|
||||
'Zunehm. Sichel': { de: 'Zunehm. Sichel', en: 'Waxing Crescent' },
|
||||
'Erstes Viertel': { de: 'Erstes Viertel', en: 'First Quarter' },
|
||||
'Zunehm. Gibbous': { de: 'Zunehm. Gibbous', en: 'Waxing Gibbous' },
|
||||
'Vollmond': { de: 'Vollmond', en: 'Full Moon' },
|
||||
'Abnehm. Gibbous': { de: 'Abnehm. Gibbous', en: 'Waning Gibbous' },
|
||||
'Letztes Viertel': { de: 'Letztes Viertel', en: 'Last Quarter' },
|
||||
'Abnehm. Sichel': { de: 'Abnehm. Sichel', en: 'Waning Crescent' },
|
||||
|
||||
'Mo.': { de: 'Mo.', en: 'Mo.' },
|
||||
'Di.': { de: 'Di.', en: 'Tu.' },
|
||||
'Mi.': { de: 'Mi.', en: 'We.' },
|
||||
'Do.': { de: 'Do.', en: 'Th.' },
|
||||
'Fr.': { de: 'Fr.', en: 'Fr.' },
|
||||
'Sa.': { de: 'Sa.', en: 'Sa.' },
|
||||
'So.': { de: 'So.', en: 'Su.' }
|
||||
};
|
||||
|
||||
window.getTranslation = function(key) {
|
||||
var lang = (window.CONFIG && window.CONFIG.language) || 'de';
|
||||
var entry = window.TRANSLATIONS[key];
|
||||
if (!entry) return key;
|
||||
return entry[lang] || entry.de || key;
|
||||
};
|
||||
|
||||
window.t = window.getTranslation;
|
||||
Reference in new issue
Block a user