Fix loading of localization when browser returns region code
E.g. if the browser returns `de-DE` or `en-US` and we don't have those specific ones, we want to fall back to `de` and `en` respectively.
This commit is contained in:
parent
d6d55c9f9c
commit
064dd195c1
|
@ -31,7 +31,11 @@ var _data = {};
|
|||
* @author svartoyg
|
||||
*/
|
||||
async function retrieveData (language) {
|
||||
return (await import(`../loc/${language}.json`)).default
|
||||
try {
|
||||
return (await import(`../loc/${language}.json`)).default
|
||||
} catch (exception) {
|
||||
return (await import(`../loc/${language.substr(0, language.indexOf('-'))}.json`)).default
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue