fis3-parser-umu-i18n
Advanced tools
Comparing version 0.0.5 to 0.0.6
17
index.js
@@ -56,2 +56,18 @@ /** | ||
ejs.filters.replace = function(lang) { | ||
var params = Array.prototype.slice.call(arguments, 1); | ||
if (typeof lang === 'string') { | ||
return lang.replace(/{\$(\d+)}/g, function (key, index) { | ||
index = parseInt(index, 10); | ||
if (index < 1) { | ||
return key; | ||
} | ||
if (typeof params[index - 1] === 'string') { | ||
return params[index - 1]; | ||
} | ||
return ''; | ||
}); | ||
} | ||
return lang; | ||
}; | ||
@@ -63,2 +79,3 @@ module.exports = function (content, file, conf) { | ||
try { | ||
content = ejs.render(content, i18nData); | ||
@@ -65,0 +82,0 @@ } catch (e) { |
{ | ||
"name": "fis3-parser-umu-i18n", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A i18n parser for fis3", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"ejs": "^2.3.4" | ||
"ejs": "1.0.0" | ||
}, | ||
@@ -11,0 +11,0 @@ "devDependencies": {}, |
2507
74