ember.jsinternationalizationember-addonember-i18n

Use ember-intl along with ember-i18n


I am using ember-i18n for translation. I installed ember-intl for formatting date in the application. Both addons have same helper {{t 'hello.world'}}. How could I use ember-i18n for translation and ember-intl for date formatting alone ?


Solution

  • You can accomplish this by explicitly defining what you want the t helper to do in your application. To do so, first generate a t helper using ember-cli:

    ember g helper t
    

    then, re-export the ember-i18n helper explicitly by pasting this code in the newly generated app/helpers/t.js file:

    export { default } from 'ember-i18n/helper';
    

    This is exactly what ember-i18n is doing to expose the t helper to your app.

    here is an ember-twiddle showing this working.