var localized_strings = {
};

/* 
param args: array to replace the {n}
example: "Total result count: {0}".localize([10])
*/
String.prototype.localize = function (args) {
	var ls = this;
    if (localized_strings[this] != undefined) {
        ls = localized_strings[this];
    }
	if (args) {
		for (var i = 0; i < args.length; i++) {
			ls = ls.replace("{" + i + "}", args[i]);
		}
	}
    return ls + '';
};

Array.prototype.localize = function () {
    for (var i = 0; i < this.length; i++) {
		var ls = this[i];
	    if (localized_strings[ls] != undefined) {
	        this[i] = localized_strings[ls] + '';
	    }
    }
    return this;
};