summaryrefslogtreecommitdiff
path: root/src/web/app/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/app/client')
-rw-r--r--src/web/app/client/script.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/web/app/client/script.js b/src/web/app/client/script.js
index 0f0fd7aa45..876d2c1694 100644
--- a/src/web/app/client/script.js
+++ b/src/web/app/client/script.js
@@ -4,6 +4,10 @@
(() => {
const head = document.getElementsByTagName('head')[0];
+ // Detect user language
+ let lang = (navigator.languages && navigator.languages[0]) || navigator.language;
+ if (!/en|en\-US|ja/.test(lang)) lang = 'en';
+
// Detect user agent
const ua = navigator.userAgent.toLowerCase();
const isMobile = /mobile|iphone|ipad|android/.test(ua);
@@ -15,7 +19,7 @@
*/
function mountDesktop() {
const script = document.createElement('script');
- script.setAttribute('src', `/assets/desktop/script.${VERSION}.js`);
+ script.setAttribute('src', `/assets/desktop/script.${VERSION}.${lang}.js`);
script.setAttribute('async', 'true');
script.setAttribute('defer', 'true');
head.appendChild(script);
@@ -31,7 +35,7 @@
head.appendChild(meta);
const script = document.createElement('script');
- script.setAttribute('src', `/assets/mobile/script.${VERSION}.js`);
+ script.setAttribute('src', `/assets/mobile/script.${VERSION}.${lang}.js`);
script.setAttribute('async', 'true');
script.setAttribute('defer', 'true');
head.appendChild(script);