User:Mike Dillon/Scripts/i18n.js

Hello, you have come here looking for the meaning of the word User:Mike Dillon/Scripts/i18n.js. In DICTIOUS you will not only get to know all the dictionary meanings for the word User:Mike Dillon/Scripts/i18n.js, but we will also tell you about its etymology, its characteristics and you will know how to say User:Mike Dillon/Scripts/i18n.js in singular and plural. Everything you need to know about the word User:Mike Dillon/Scripts/i18n.js you have here. The definition of the word User:Mike Dillon/Scripts/i18n.js will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofUser:Mike Dillon/Scripts/i18n.js, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
var wgMessageCache = {};

var wgFallbackLanguage;

function wfAddMsg(lang, key, value) {
    if (!wgMessageCache) {
        wgMessageCache = {};
    }
    wgMessageCache = value;
}

function wfMsgReal(key, forContent, args) {
    function wfMsgGet(lang, key) {
        if (!wgMessageCache) return null;
        return wgMessageCache;
    }

    // Bail out of the key is null
    if (key == null) return null;

    var msg = null;

    // Look for message in user language
    if (!forContent) {
        msg = wfMsgGet(wgUserLanguage, key);
    }

    // Else, use content language
    if (msg == null) {
        msg = wfMsgGet(wgContentLanguage, key);
    }

    // Else, use fallback language
    if (msg == null && wgFallbackLanguage) {
        msg = wfMsgGet(wgFallbackLanguage, key);
    }

    // Else, use fallback text
    if (msg == null) {
        msg = "<" + key.toLowerCase() + ">";
    }

    // Replace positional placeholders (e.g. $1 or ${1})
    if (args.length > 1) {
        var re = /\$(?:(\d*)|\{(\d*)\})/g;

        var m;
        var toReplace = ;
        while (m = re.exec(msg)) {
            toReplace.push({
                'pos': re.lastIndex - m.length,
                'len': m.length,
                'arg': m || m
            });
        }

        var adjust = 0;
        for (var n in toReplace) {
            var replacement = args.arg];
            if (replacement == null) continue;
            replacement = replacement.toString();

            toReplace.pos += adjust;

            msg = msg.substring(0, toReplace.pos)
                + replacement
                + msg.substring(toReplace.pos + toReplace.len);

            adjust += replacement.length - toReplace.len;
        }
    }

    return msg;
}

function wfMsg(key) {
    return wfMsgReal(key, false, arguments);
}

function wfMsgForContent(key) {
    return wfMsgReal(key, true, arguments);
}