
/* gettext library */

var catalog = new Array();

function pluralidx(count) {
    if (count == 1) {
        return 0;
    } else {
        return 1;
    }
}


function gettext(msgid) {
    var value = catalog[msgid];
    if (typeof(value) == 'undefined') {
        return msgid;
    } else {
        if (typeof(value) == 'string') {
            return value;
        } else {
            return value[0];
        }
    }
}

function ngettext(singular, plural, count) {
    value = catalog[singular];
    if (typeof(value) == 'undefined') {
        if (count == 1) {
            return singular;
        } else {
            return plural;
        }
    } else {
        return value[pluralidx(count)];
    }
}

function gettext_noop(msgid) {
    return msgid;
}

function interpolate(fmt, obj, named) {
    if (named) {
        return fmt.replace(/%\(\w+\)s/, function(match){return String(obj[match.slice(2,-2)])});
    } else {
        return fmt.replace(/%s/, function(match){return String(obj.shift())});
    }
}
