var lang = {}
    ,locale;

/**
 * @param {string=} lg
**/
function initLang(lg) {
    if (!lg) {
        for (var i=0, nbLang = navigator.languages.length; i < nbLang; i++)
            if (lang.hasOwnProperty(navigator.languages[i])) {
                lg = navigator.languages[i];
                break;
            }
        if (!lg)
            lg = 'en';
    }
    locale = lang[lg];
    console.log("Loading language pack: " +lg);
    if (locale.dom)
        for (var i in locale.dom)
            document.getElementById(i).textContent = locale.dom[i];
}

