gettext-handlebars
Advanced tools
Comparing version 0.2.0 to 0.2.1
31
index.js
@@ -35,18 +35,25 @@ var Handlebars = require('handlebars'); | ||
if (statement.type && statement.type === 'sexpr') { | ||
if (keywords.indexOf(statement.id.string) >= 0) { | ||
var idx = keywordSpec[statement.id.string], | ||
param = statement.params[idx[0]]; | ||
switch (statement.type) { | ||
case 'sexpr': | ||
if (keywords.indexOf(statement.id.string) >= 0) { | ||
var idx = keywordSpec[statement.id.string], | ||
param = statement.params[idx[0]]; | ||
if (param && param.type === 'STRING') { | ||
msgs[param.string] = msgs[param.string] || {line: []}; | ||
msgs[param.string].line.push(param.firstLine); | ||
} | ||
if (param && param.type === 'STRING') { | ||
msgs[param.string] = msgs[param.string] || {line: []}; | ||
msgs[param.string].line.push(param.firstLine); | ||
} | ||
if (idx[1] && statement.params[idx[1]]) { | ||
msgs[param.string].plural = msgs[param.string].plural || statement.params[idx[1]].string; | ||
if (idx[1] && statement.params[idx[1]]) { | ||
msgs[param.string].plural = msgs[param.string].plural || statement.params[idx[1]].string; | ||
} | ||
} | ||
} | ||
statement.params.reduce(isMsg, msgs); | ||
statement.params.reduce(isMsg, msgs); | ||
break; | ||
case 'block': | ||
statement.program.statements.reduce(isMsg, msgs); | ||
break; | ||
} | ||
@@ -53,0 +60,0 @@ |
{ | ||
"name": "gettext-handlebars", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Extract translatable strings from Handlebars templates", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
4759
52