<img src="logo.png" alt="Logo">
<div style="flex-grow: 1;"></div>
- <select id="language-selection" onchange="current_language=this.children[this.selectedIndex].value; translate();" size="1">
+ <select id="language-selection" onchange="config.language=this.children[this.selectedIndex].value; translate();" size="1">
<option value="en">English</option>
<option value="de">Deutsch</option>
</select>
var current_model = {};
-var current_language = config.language;
function $(id) {
return document.getElementById(id);
// Change the translation of the entire document
function translate() {
- var mapping = translations[current_language];
+ var mapping = translations[config.language];
for (var tr in mapping) {
Array.from(document.getElementsByClassName(tr))
.forEach(e => { e.innerText = mapping[tr]; })
// hide fields
updateImages();
+
+var user_lang = (navigator.language || navigator.userLanguage).split('-')[0];
+if (user_lang in translations) {
+ config.language = user_lang;
+ $('language-selection').value = user_lang;
+}
+
translate();