forked from verdnatura/hedera-web
52 lines
1.0 KiB
JavaScript
52 lines
1.0 KiB
JavaScript
|
|
var Hedera = require ('hedera/hedera');
|
|
|
|
window.onload = function ()
|
|
{
|
|
Vn.Locale.init ();
|
|
var lang = Vn.Locale.language;
|
|
loadLocale (lang, main);
|
|
}
|
|
|
|
function main (req)
|
|
{
|
|
var keys = req.keys ();
|
|
|
|
for (var i = 0; i < keys.length; i++)
|
|
Vn.Locale.add (req (keys[i]));
|
|
|
|
hederaWeb = new Hedera.App ();
|
|
hederaWeb.run ();
|
|
}
|
|
|
|
function loadLocale (lang, cb)
|
|
{
|
|
switch (lang)
|
|
{
|
|
case 'ca':
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/ca.json$/)); });
|
|
break;
|
|
case 'es':
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/es.json$/)); });
|
|
break;
|
|
case 'fr':
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/fr.json$/)); });
|
|
break;
|
|
case 'mn':
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/mn.json$/)); });
|
|
break;
|
|
case 'pt':
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/pt.json$/)); });
|
|
break;
|
|
default:
|
|
require ([], function () {
|
|
cb (require.context ('js', true, /locale\/en.json$/)); });
|
|
}
|
|
}
|
|
|