summaryrefslogtreecommitdiff
path: root/lang.js
diff options
context:
space:
mode:
authorJulian Kirsch <kirschju@sec.in.tum.de>2014-11-18 17:10:57 +0100
committerJulian Kirsch <kirschju@sec.in.tum.de>2014-11-18 17:10:57 +0100
commit4bf637cfc66e6720bcf4c215994bb6c4f116ad72 (patch)
tree353396d1bf51878dbea6f32cce82a172f6c18081 /lang.js
parent0c8f12e2a9e85bef7ee04ab69583370450997633 (diff)
downloadwww-4bf637cfc66e6720bcf4c215994bb6c4f116ad72.tar.gz
www-4bf637cfc66e6720bcf4c215994bb6c4f116ad72.tar.bz2
www-4bf637cfc66e6720bcf4c215994bb6c4f116ad72.zip
Lang
Diffstat (limited to 'lang.js')
-rw-r--r--lang.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/lang.js b/lang.js
index a4b6f385..d726a5aa 100644
--- a/lang.js
+++ b/lang.js
@@ -14,15 +14,24 @@ function setLang(l)
}
}
+function get_default_lang()
+{
+ for (l in navigator.languages) {
+ for (j in ['en', 'de', 'fr']) {
+ if (l.search(j) != -1)
+ return j;
+ }
+ }
+
+ return 'en';
+}
function loadLang()
{
+ l = '';
if (supports_html5_storage()) {
l = sessionStorage.getItem('lang');
- if (l == '') {
- l = navigator.userLanguage || navigator.language;
- }
- } else {
- l = navigator.userLanguage || navigator.language;
}
+
+ if (l == '') l = get_default_lang();
setLang(l);
}