forked from verdnatura/hedera-web
72 lines
1.3 KiB
JavaScript
72 lines
1.3 KiB
JavaScript
|
|
var assetsPath;
|
|
|
|
if (_DEV_MODE)
|
|
{
|
|
var host = window.location.host.split(':')[0];
|
|
assetsPath = 'http://'+ host +':'+ _DEV_SERVER_PORT +'/'+ _PUBLIC_PATH;
|
|
}
|
|
else
|
|
assetsPath = _PUBLIC_PATH;
|
|
|
|
__webpack_public_path__ = assetsPath;
|
|
|
|
require ('hedera/hedera');
|
|
|
|
window.onload = function ()
|
|
{
|
|
loadLocale (main);
|
|
}
|
|
|
|
function main (req)
|
|
{
|
|
if (req)
|
|
onLocaleLoad (req);
|
|
|
|
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);
|
|
|
|
switch (lang)
|
|
{
|
|
case 'ca':
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/ca.yml$/)); });
|
|
break;
|
|
case 'es':
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/es.yml$/)); });
|
|
break;
|
|
case 'fr':
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/fr.yml$/)); });
|
|
break;
|
|
case 'mn':
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/mn.yml$/)); });
|
|
break;
|
|
case 'pt':
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/pt.yml$/)); });
|
|
break;
|
|
default:
|
|
cb ();
|
|
}
|
|
}
|
|
|
|
function onLocaleLoad (req)
|
|
{
|
|
var keys = req.keys ();
|
|
|
|
for (var i = 0; i < keys.length; i++)
|
|
Vn.Locale.add (req (keys[i]));
|
|
}
|