mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-30 04:13:03 +00:00
This commit is contained in:
parent
50f0b5539d
commit
f81de35028
1 changed files with 6 additions and 2 deletions
|
@ -10,15 +10,19 @@ import * as yaml from 'js-yaml';
|
||||||
import version from './src/version';
|
import version from './src/version';
|
||||||
const constants = require('./src/const.json');
|
const constants = require('./src/const.json');
|
||||||
|
|
||||||
const languages = {
|
let languages = {
|
||||||
'en': yaml.safeLoad(fs.readFileSync('./locales/en.yml', 'utf-8')),
|
'en': yaml.safeLoad(fs.readFileSync('./locales/en.yml', 'utf-8')),
|
||||||
'ja': yaml.safeLoad(fs.readFileSync('./locales/ja.yml', 'utf-8'))
|
'ja': yaml.safeLoad(fs.readFileSync('./locales/ja.yml', 'utf-8'))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const native = languages.ja;
|
||||||
|
|
||||||
const env = process.env.NODE_ENV;
|
const env = process.env.NODE_ENV;
|
||||||
const isProduction = env === 'production';
|
const isProduction = env === 'production';
|
||||||
|
|
||||||
module.exports = (Object as any).entries(languages).map(([lang, locale]) => {
|
module.exports = (Object as any).entries(languages).map(([lang, locale]) => {
|
||||||
|
locale = Object.assign(native, locale);
|
||||||
|
|
||||||
const pack /*: webpack.Configuration ← fuck wrong type definition!!! */ = {
|
const pack /*: webpack.Configuration ← fuck wrong type definition!!! */ = {
|
||||||
name: lang,
|
name: lang,
|
||||||
entry: {
|
entry: {
|
||||||
|
@ -48,7 +52,7 @@ module.exports = (Object as any).entries(languages).map(([lang, locale]) => {
|
||||||
});
|
});
|
||||||
if (error) {
|
if (error) {
|
||||||
console.warn(`key '${key}' not found in '${lang}'`);
|
console.warn(`key '${key}' not found in '${lang}'`);
|
||||||
return '-UNTRANSLATED-';
|
return key;
|
||||||
} else {
|
} else {
|
||||||
return text.replace(/'/g, '\\\'').replace(/"/g, '\\"');
|
return text.replace(/'/g, '\\\'').replace(/"/g, '\\"');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue