How to use action helper in a i18n key. For example, the i18n key is
Please <a{{action displayList}}>click here</a> to display the list.
How to translate this properly with ember runtime(i.e handlebars uncompiled version)
How to use action helper in a i18n key. For example, the i18n key is
Please <a{{action displayList}}>click here</a> to display the list.
How to translate this properly with ember runtime(i.e handlebars uncompiled version)
It is been a while since this question was asked, but since I haven't found the solution anywhere, let me put my solution here. The way I solved it is using Handlebars subexpressions. For your example it would look like this:
in translation file
var translations = {
'fb.clickhere.msg': 'Please <a {{actionDisplayList}}>click here</a> to display the list.'
}
in Handlebars template
{{t 'fb.clickhere.msg' actionDisplayList=(action "displayList") }}
If Handlebar helpers support returning Ember.View
instance then the following defined helper should work
{{localizedView fb.clickhere.msg}}
Handlebars.registerBoundHelper("localizedView", function(value, options){
// value = fb.clickhere.msg
var localizedString = loc(value); // localizedString = "<a{{action displayList}}>click here</a>"
return Ember.View.create({template: Ember.Handlebars.compile(localizedString)});
}) // Ofcourse you should define it before you can use this