XMPP invitation landing page, without javascript
Diffstat (limited to 'scripts/main.js')
| -rw-r--r-- | scripts/main.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/scripts/main.js b/scripts/main.js index 535a137..52b929a 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -94,7 +94,19 @@ i18n.once(I18nText.event.LOCALE_CHANGE, function (data) { rehash(); }); - i18n.setLocale('en'); + + var preferredLocale, setLocale = false; + for (preferredLocale of navigator.languages) { + if (supportedLocales.includes(preferredLocale)) { + i18n.setLocale(preferredLocale); + setLocale = true; + break; + } + } + if (!setLocale) { + i18n.setLocale(defaultLocale); + } + // functionality if (navigator.userAgent.indexOf("Android") >= 0) { |