jormungandr-bite/locales/index.ts
Marcin Mikołajczak dad998729e i18n: Add Polish translation
Signed-off-by: Marcin Mikołajczak <me@m4sk.in>
2018-05-04 00:28:07 +02:00

25 lines
472 B
TypeScript

/**
* 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 = {
'en': loadLang('en'),
'fr': loadLang('fr'),
'ja': native,
'pl': loadLang('pl')
};
Object.entries(langs).map(([, locale]) => {
// Extend native language (Japanese)
locale = Object.assign({}, native, locale);
});
export default langs;