/ Published in: JavaScript
URL: http://kaedatorum.net/blog
This snippet extends the String object so that you can localize() i18n strings
Expand |
Embed | Plain Text
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; };
You need to login to post a comment.
