Reputation: 545
I created a Handlebars helper for our own i18n library which looks a bit like this:
Handlebars.registerHelper('i18n', (type, key, optionalValue) => optionalValue ?
i18n[type](key, optionalValue.hash) :
i18n[type](key)
);
I want to use this helper te generate a value to pass on to a partial. Something like this:
{{> myPartial header={{i18n 'text' 'my.translation.key}}}}
As expected this generated a syntax error.
Any ideas how I could accomplish this behaviour?
Upvotes: 1
Views: 204
Reputation: 12872
To nest helper you can use (
{{myPartial header=(i18n 'text' 'my.translation.key')}}
Upvotes: 1