Skip to content
Snippets Groups Projects
Commit 78c7dd62 authored by Karl Hasselbring's avatar Karl Hasselbring
Browse files

Übersetzungsfunktion erweitert und Dokumentiert

parent 99f1ed14
No related branches found
No related tags found
2 merge requests!1184Development,!1137Resolve "Übersetzung für JS-Dateien einbauen"
translations = {
// Speichert die Übersetzungen
var translations = {
'de': {
'key': 'Bitte mindestens 1 Suchmaschine auswählen.'
},
......@@ -10,4 +11,26 @@ translations = {
'es': {
'key': 'Por favor, seleccione al menos un motor de búsqueda.'
}
}
\ No newline at end of file
}
/**
* Übersetzt den gegebenen Schlüssel in der gegebenen Sprache
* @param {string} key Zu übersetzender Schlüssel
* @param {string} lang Zu verwendende Sprache
*/
function t(key, lang) {
if (translations[lang] && translations[lang][key]) {
return translations[lang][key];
} else {
return '';
}
}
/**
* Übersetzt den gegebenen Schlüssel in der aktuellen Sprache des HTML-Dokuments (<html lang="...">)
* @param {string} key Zu übersetzender Schlüssel
*/
function t(key) {
var lang = $('html').attr('lang');
return t(key, lang);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment