$.lang = {};
//default set
$.lang.currentLang = "en"

function setLanguage(language) {
    if(language.indexOf("ja") > -1) {
        $.lang.currentLang = "ja"
    } else if(language.indexOf("ko") > -1) {
        $.lang.currentLang = "ko"
    } else {
        $.lang.currentLang = "en"
    }
}

function getLocalizedString(stringKey, ...args)
{   
    let string = $.lang[$.lang.currentLang][stringKey];
    if(args.length > 0) {
        if(args.length == 1) {
            string = string.replace("%@", args[0])
        } else {
            string = string.replace("%@", args.join($.lang[$.lang.currentLang].userListDivideString))
        }
    }
    return string
}