Works after a tweak. I recommend falling back to en-GB if a matching lang isn't found.
Basically replace
let siteLang = document.getElementsByTagName("html")[0].getAttribute("lang");
if (!(siteLang in langs)) {
console.error(`Language ${siteLang} is not supported.`);
return;
}
with this:
let siteLang = document.getElementsByTagName("html")[0].getAttribute("lang");
if (!(siteLang in langs)) {
console.warn(`Language ${siteLang} is not supported, falling back to en-GB.`);
siteLang = "en-GB";
}
Works after a tweak. I recommend falling back to en-GB if a matching lang isn't found.
Basically replace
with this: