summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--site/i18n.js12
-rw-r--r--site/index.html2
2 files changed, 9 insertions, 5 deletions
diff --git a/site/i18n.js b/site/i18n.js
index 5f882c5..829373e 100644
--- a/site/i18n.js
+++ b/site/i18n.js
@@ -54,12 +54,16 @@ let locale = "en";
// is found, it returns the key as a fallback value
// (therefore, keys should themselves be understandable texts)
export function _(key) {
- return !(locale in langs) ? key
- : !(key in langs[locale]) ? key
- : langs[locale][key]
+ if (!(locale in langs) ? false : (key in langs[locale])) {
+ return langs[locale][key];
+ } else {
+ console.log("missing translation for lang, key:", locale, key);
+ return key;
+ }
}
export function setLang (loc) {
+ console.log("set lang to", loc);
locale = loc;
}
@@ -69,7 +73,7 @@ export function setLang (loc) {
export function tryBrowserDefaultLang () {
let guess = navigator.language;
if (guess in langs) {
- setLang(lang);
+ setLang(guess);
} else {
for (var lang of navigator.languages) {
if (lang in langs) {
diff --git a/site/index.html b/site/index.html
index c2ac9c9..4034787 100644
--- a/site/index.html
+++ b/site/index.html
@@ -251,7 +251,7 @@
mkElement("p", msg, "error"),
appendChildren(
mkElement("p",_("attempted path:"),"error"),
- [mkElement("tt", surveyUrl,"error")]
+ [mkElement("tt"," "+surveyUrl,"error")]
)
]);
}