How to use the ember-intl.translationMacro function in ember-intl

To help you get started, weā€™ve selected a few ember-intl examples, based on popular ways it is used in public projects.

github hummingbird-me / hummingbird-client / app / components / modals / media-review.js View on Github external
import Component from 'ember-component';
import get from 'ember-metal/get';
import set from 'ember-metal/set';
import service from 'ember-service/inject';
import computed, { alias } from 'ember-computed';
import { isPresent } from 'ember-utils';
import { task } from 'ember-concurrency';
import { translationMacro as t } from 'ember-intl';

export default Component.extend({
  classNames: ['review-modal'],
  intl: service(),
  metrics: service(),
  store: service(),
  rating: alias('review.libraryEntry.rating'),
  errorMessage: t('errors.request'),

  isValid: computed('rating', 'review.content', function() {
    return (get(this, 'rating') > 0) && isPresent(get(this, 'review.content'));
  }).readOnly(),

  init() {
    this._super(...arguments);
    // make sure the required data is loaded into the mode
    get(this, 'loadReview').perform().then(() => {
      get(this, 'loadRelationships').perform();
    }).catch(() => {});
  },

  willDestroyElement() {
    this._super(...arguments);
    get(this, 'review').rollbackAttributes();
github ember-intl / ember-intl / tests / unit / utils / macros.js View on Github external
beforeEach() {
    const intl = this.subject();
    intl.setLocale('en');

    this.object = Ember.Object
      .extend({
        intl: intl,
        numberClicks: 9,
        tMacroProperty1: t('no.interpolations'),
        tMacroProperty2: t('with.interpolations', { clicks: 'numberClicks' })
      })
      .create();
  }
});
github ember-intl / ember-intl / tests / unit / utils / macros.js View on Github external
beforeEach() {
    const intl = this.subject();
    intl.setLocale('en');

    this.object = Ember.Object
      .extend({
        intl: intl,
        numberClicks: 9,
        tMacroProperty1: t('no.interpolations'),
        tMacroProperty2: t('with.interpolations', { clicks: 'numberClicks' })
      })
      .create();
  }
});