[Client] Better language detection

This commit is contained in:
syuilo 2017-03-27 04:49:31 +09:00
parent 692bd515e3
commit 9066052d36
1 changed files with 1 additions and 1 deletions

View File

@ -5,7 +5,7 @@
const head = document.getElementsByTagName('head')[0]; const head = document.getElementsByTagName('head')[0];
// Detect user language // Detect user language
let lang = ((navigator.languages && navigator.languages[0]) || navigator.language).split('-')[0].toLowerCase(); let lang = navigator.language.split('-')[0];
if (!/^(en|ja)$/.test(lang)) lang = 'en'; if (!/^(en|ja)$/.test(lang)) lang = 'en';
// Detect user agent // Detect user agent