Override language setting if language is unsupported

This commit is contained in:
Pieter Vander Vennet 2020-07-24 17:34:15 +02:00
parent 25281121d3
commit 2a61ae6e1f

View file

@ -124,6 +124,14 @@ window.setLanguage = function (language: string) {
Locale.language.setData(language)
}
Locale.language.addCallback((currentLanguage) => {
console.log("REsetting languate to", layoutToUse.supportedLanguages[0])
if (layoutToUse.supportedLanguages.indexOf(currentLanguage) < 0) {
// The current language is not supported -> switch to a supported one
Locale.language.setData(layoutToUse.supportedLanguages[0]);
}
}).ping()
const saveTimeout = 30000; // After this many milliseconds without changes, saves are sent of to OSM
const allElements = new ElementStorage();