john remi
john remi

Reputation: 45

ember-intl for translating html

I'm using ember-intl and would like to translate html (href with link):

en-us.json:

{
   "sign-up": "Didn't get it? check your spam folder, or try to '<a {myLink}>'send a new passcode'</a>'",
}

My controller has an action that is called: signUp:

actions: {
    signUp: function() {
      console.log('success');
    },
}

In my hbs file, I tried:

{{{t 'sign-up' myLink=(action 'signUp')}}}

The text was set, and the link looks as a link, but when I click on this link, the log is not written.

Any help appreciated!

Upvotes: 0

Views: 579

Answers (1)

gabrimac
gabrimac

Reputation: 526

Check this thread in stackoverflow:

Combine linkTo and action helpers in Ember.js

probably after installing the library

ember-link-action

you can do something like

{{#link-to 'other-route' invokeAction=(action 'signUp')}}
  {{t 'sign-up'}}
{{/link-to}}

Upvotes: 0

Related Questions