String.prototype.localize = function(){
var cReturnValue = (i18n) ? i18n[this] : this;
if(!cReturnValue){
cReturnValue = "§§§" + this + "§§§";
} else {
for (var i = 0; i < arguments.length; i++){
cReturnValue = cReturnValue.replace("{" + i + "}", arguments[i]);
}
}
return cReturnValue;
};
JavaScript i18n String object & localize method
Leave a Reply
You must be logged in to post a comment.