|
|
@ -6,6 +6,9 @@ |
|
|
|
// translators: add your language code here such as "es" for Spanish, "ru" for Russian
|
|
|
|
// translators: add your language code here such as "es" for Spanish, "ru" for Russian
|
|
|
|
var knownLanguages = ["en","nl","it","fr","ru","de","zh"]; |
|
|
|
var knownLanguages = ["en","nl","it","fr","ru","de","zh"]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// get localstorage language
|
|
|
|
|
|
|
|
var preferredLanguagel = localStorage.getItem("preferredLanguagel"); |
|
|
|
|
|
|
|
|
|
|
|
// detect language with JavaScript
|
|
|
|
// detect language with JavaScript
|
|
|
|
var preferredLanguage = window.navigator.userLanguage || window.navigator.language || "en"; |
|
|
|
var preferredLanguage = window.navigator.userLanguage || window.navigator.language || "en"; |
|
|
|
if(knownLanguages.indexOf(preferredLanguage) > -1){ |
|
|
|
if(knownLanguages.indexOf(preferredLanguage) > -1){ |
|
|
@ -20,6 +23,14 @@ else{ |
|
|
|
// did not find match
|
|
|
|
// did not find match
|
|
|
|
preferredLanguage = "en"; |
|
|
|
preferredLanguage = "en"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (preferredLanguage !== preferredLanguagel) { |
|
|
|
|
|
|
|
console.log('use language from localstorage'); |
|
|
|
|
|
|
|
var preferredLanguage = preferredLanguagel; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
console.log('use auto language'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// set up Polyglot
|
|
|
|
// set up Polyglot
|
|
|
|
polyglot = new Polyglot(); |
|
|
|
polyglot = new Polyglot(); |
|
|
|