Permalink
Browse files

Update comments in `i18n.js`.

  • Loading branch information...
Kit Goncharov
Kit Goncharov committed Apr 27, 2011
1 parent 1f211a0 commit 91da188a1d7e0f3ac00ab539717796d507207544
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/i18n.js
View
@@ -6,7 +6,7 @@ var path = require('path'), I18n = module.exports = function I18n(path, language
// The current version of `node-i18n`. Keep in sync with `package.json`.
I18n.VERSION = '0.2';
-// Default template settings; used in `I18n#t`.
+// Default template settings; used in `I18n#interpolate`.
I18n.templateSettings = {
'evaluate': /<%([\s\S]+?)%>/g,
'interpolate': /<%=([\s\S]+?)%>/g
@@ -42,6 +42,7 @@ I18n.prototype.interpolate = function interpolate(item, context) {
if (typeof context == 'object') {
settings = I18n.templateSettings;
+ // JavaScript micro-templating implementation; taken from Underscore.
return Function('obj', 'var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(\'' +
result.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(settings.interpolate, function(match, code) {
return "'," + code.replace(/\\'/g, "'") + ",'";

0 comments on commit 91da188

Please sign in to comment.