mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-22 16:05:12 +00:00
8d53f8639e
Signed-off-by: Marcin Mikołajczak <me@m4sk.in>
25 lines
472 B
TypeScript
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;
|