I have registered a handlebars helper by the name of "t" that will translate a string. I have a Handlebars template which uses the value of a variable that will be a word:
{{{word}}}
I would like to translate the value of that variable using my helper, but cannot do
{{t "{{{word}}}" }} or {{t {{{word}}} }}
I am inexperienced with Handlebars and am wondering - What is the simplest way to achieve this?
{{t word}}
Simply pass the reference into your helper without brackets.
You only need brackets for outputting the value of the reference to the page:
UPDATE:
If you need to perform some kind of operation (such as escaping HTML) on the value of
word
, you can make a second helper and pass that into your first helper using(
parentheses)
:{{t (myOtherHelper word)}}