This commit is contained in:
syuilo 2018-05-17 15:41:07 +09:00
parent 7023014218
commit 5d6dfb425d
4 changed files with 7 additions and 3 deletions

View file

@ -20,6 +20,7 @@ import * as replace from 'gulp-replace';
import * as htmlmin from 'gulp-htmlmin'; import * as htmlmin from 'gulp-htmlmin';
const uglifyes = require('uglify-es'); const uglifyes = require('uglify-es');
import locales from './locales';
import { fa } from './src/build/fa'; import { fa } from './src/build/fa';
const client = require('./built/client/meta.json'); const client = require('./built/client/meta.json');
import config from './src/config'; import config from './src/config';
@ -122,6 +123,7 @@ gulp.task('build:client:script', () =>
.pipe(replace('VERSION', JSON.stringify(client.version))) .pipe(replace('VERSION', JSON.stringify(client.version)))
.pipe(replace('API', JSON.stringify(config.api_url))) .pipe(replace('API', JSON.stringify(config.api_url)))
.pipe(replace('ENV', JSON.stringify(env))) .pipe(replace('ENV', JSON.stringify(env)))
.pipe(replace('LANGS', JSON.stringify(Object.keys(locales))))
.pipe(isProduction ? uglify({ .pipe(isProduction ? uglify({
toplevel: true toplevel: true
} as any) : gutil.noop()) } as any) : gutil.noop())

View file

@ -11,6 +11,7 @@ const loadLang = lang => yaml.safeLoad(
const native = loadLang('ja'); const native = loadLang('ja');
const langs = { const langs = {
'de': loadLang('de'),
'en': loadLang('en'), 'en': loadLang('en'),
'fr': loadLang('fr'), 'fr': loadLang('fr'),
'ja': native, 'ja': native,

View file

@ -32,7 +32,7 @@
// Detect the user language // Detect the user language
// Note: The default language is Japanese // Note: The default language is Japanese
let lang = navigator.language.split('-')[0]; let lang = navigator.language.split('-')[0];
if (!/^(en|ja)$/.test(lang)) lang = 'ja'; if (!LANGS.includes(lang)) lang = 'en';
if (localStorage.getItem('lang')) lang = localStorage.getItem('lang'); if (localStorage.getItem('lang')) lang = localStorage.getItem('lang');
// Detect the user agent // Detect the user agent

View file

@ -80,10 +80,11 @@
<el-option label="自動" value=""/> <el-option label="自動" value=""/>
</el-option-group> </el-option-group>
<el-option-group label="言語を指定"> <el-option-group label="言語を指定">
<el-option label="ja-JP" value="ja"/> <el-option label="ja" value="ja"/>
<el-option label="en-US" value="en"/> <el-option label="en" value="en"/>
<el-option label="fr" value="fr"/> <el-option label="fr" value="fr"/>
<el-option label="pl" value="pl"/> <el-option label="pl" value="pl"/>
<el-option label="de" value="de"/>
</el-option-group> </el-option-group>
</el-select> </el-select>
<div class="none ui info"> <div class="none ui info">