hedera-web/app.js

39 lines
698 B
JavaScript

__webpack_public_path__ = _PUBLIC_PATH;
require('hedera/hedera');
const locales = require('./import').locales;
const packageJson = require('./package.json');
window.onload = function() {
loadLocale(main);
}
function main(req) {
if (req) onLocaleLoad(req);
Vn.setVersion(packageJson.version);
hederaWeb = new Hedera.App();
hederaWeb.run();
}
function loadLocale(cb) {
Vn.Locale.init();
var lang = Vn.Locale.language;
var req = require.context('js', true, /locale\/en.yml$/);
onLocaleLoad(req);
const fn = locales[lang];
if (fn)
fn(cb);
else
cb();
}
function onLocaleLoad(req) {
var keys = req.keys();
for (var i = 0; i < keys.length; i++)
Vn.Locale.add(req(keys[i]));
}