hedera-web/app.js

42 lines
860 B
JavaScript

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