Refactoring
This commit is contained in:
parent
e237c53766
commit
fb70e3b176
12 changed files with 202 additions and 121 deletions
23
webpack/langs.ts
Normal file
23
webpack/langs.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* Languages Loader
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as yaml from 'js-yaml';
|
||||
|
||||
const loadLang = lang => yaml.safeLoad(
|
||||
fs.readFileSync(`./locales/${lang}.yml`, 'utf-8'));
|
||||
|
||||
const native = loadLang('ja');
|
||||
|
||||
const langs = Object.entries({
|
||||
'en': loadLang('en'),
|
||||
'ja': native
|
||||
});
|
||||
|
||||
langs.map(([, locale]) => {
|
||||
// Extend native language (Japanese)
|
||||
locale = Object.assign({}, native, locale);
|
||||
});
|
||||
|
||||
export default langs;
|
Loading…
Add table
Add a link
Reference in a new issue