Sharkey/locales/index.js

28 lines
507 B
JavaScript
Raw Normal View History

2018-07-06 03:17:38 +00:00
/**
* Languages Loader
*/
const fs = require('fs');
const yaml = require('js-yaml');
const loadLang = lang => yaml.safeLoad(
2018-07-11 05:19:55 +00:00
fs.readFileSync(`${__dirname}/${lang}.yml`, 'utf-8'));
2018-07-06 03:17:38 +00:00
const native = loadLang('ja');
const langs = {
'de': loadLang('de'),
'en': loadLang('en'),
'fr': loadLang('fr'),
'ja': native,
'pl': loadLang('pl'),
'es': loadLang('es')
};
2018-07-23 05:04:53 +00:00
Object.values(langs).forEach(locale => {
2018-07-06 03:17:38 +00:00
// Extend native language (Japanese)
2018-07-23 05:04:53 +00:00
Object.assign(locale, native);
2018-07-06 03:17:38 +00:00
});
module.exports = langs;