I’ve got a HTML template which should apply certain content based on the language version. For “pl-PL” a polish version and for any other english. Now, I’m passing language parameter in report request. I’ve written simple handlebars helper:
Handlebars.RegisterHelper("IsPolish", (writer, context, parameters) =>
{
if (req.Lang == "pl-PL")
writer.WriteSafeString(true);
else writer.WriteSafeString(false);
});
The helper returns correct value, but Handlebars does not interpret it correctly:
<td style="width:35%">{{IsPolish}}</td>
<td style="width:15%">{{#if (IsPolish)}}TRUE{{else}}FALSE{{/if}}</td>
After rendering it shows:
<td style="width:35%">False</td>
<td style="width:15%">TRUE</td>
From what I’ve read, the Handlebars is case sensitive and .net serializes boolean values with first capital letter first, but I do not have a clue how to overcome it.