From 41c1ad9ca4a99b962381bda94b9dbfd610dad736 Mon Sep 17 00:00:00 2001 From: Hannes Mannerheim Date: Tue, 17 Jan 2017 17:54:22 +0100 Subject: [PATCH] use english is browser language is not set --- js/qvitter.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/qvitter.js b/js/qvitter.js index 3db4271..fb0ccc0 100644 --- a/js/qvitter.js +++ b/js/qvitter.js @@ -750,6 +750,11 @@ $(window).load(function() { // set language, from local storage, else browser language var browserLang = navigator.language || navigator.userLanguage; + // use english if browser has no language set + if(typeof browserLang == 'undefined') { + var browserLang = 'en-GB'; + } + // browsers report e.g. sv-SE but we want it in the format "sv" or "sv_se" browserLang = browserLang.replace('-','_').toLowerCase();