diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-03-23 05:53:09 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-03-23 05:53:09 +0900 |
| commit | abb8e021ba776a9e9c400a2bfab2c220ec8316e5 (patch) | |
| tree | 1b37ee7c208bf375ca2d459698e65dcb9d738e17 /src/web/app/client | |
| parent | Fix bug (diff) | |
| download | sharkey-abb8e021ba776a9e9c400a2bfab2c220ec8316e5.tar.gz sharkey-abb8e021ba776a9e9c400a2bfab2c220ec8316e5.tar.bz2 sharkey-abb8e021ba776a9e9c400a2bfab2c220ec8316e5.zip | |
wip #313
Diffstat (limited to 'src/web/app/client')
| -rw-r--r-- | src/web/app/client/script.js | 8 |
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); |