1
0
forked from mirror/misskey

Better English

This commit is contained in:
syuilo 2017-05-18 14:29:55 +09:00
parent 2c3dbf8e64
commit 7c7e824070

View File

@ -21,12 +21,12 @@ const Url = new URL(location.href);
// dev.misskey.alice.tachibana => dev // dev.misskey.alice.tachibana => dev
let app = Url.host.split('.')[0]; let app = Url.host.split('.')[0];
// Detect user language // Detect the user language
// Note: The default language is English // Note: The default language is English
let lang = navigator.language.split('-')[0]; let lang = navigator.language.split('-')[0];
if (!/^(en|ja)$/.test(lang)) lang = 'en'; if (!/^(en|ja)$/.test(lang)) lang = 'en';
// Detect user agent // Detect the user agent
const ua = navigator.userAgent.toLowerCase(); const ua = navigator.userAgent.toLowerCase();
const isMobile = /mobile|iphone|ipad|android/.test(ua); const isMobile = /mobile|iphone|ipad|android/.test(ua);
@ -46,8 +46,8 @@ if (app == 'misskey') {
app = isMobile ? 'mobile' : 'desktop'; app = isMobile ? 'mobile' : 'desktop';
} }
// Load app script // Load an app script
// Note: 'async' makes can load the script async. // Note: 'async' makes can load the script asyncly.
// 'defer' makes can run script when the dom loaded. // 'defer' makes can run script when the dom loaded.
const script = document.createElement('script'); const script = document.createElement('script');
script.setAttribute('src', `/assets/${app}.${VERSION}.${lang}.js`); script.setAttribute('src', `/assets/${app}.${VERSION}.${lang}.js`);