Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

Commit

Permalink
allow runtime override of Ember.I18n
Browse files Browse the repository at this point in the history
Do not destructure before exporting.

Fixes using `ember-i18n`.

Otherwise the workaround [described
here](https://github.com/DockYard/ember-validations/issues/366#issuecomment-169869004)
using `ember-i18n` does not work. When running multiple tests,
ember-validations will use a destroyed version of `i18n` from the 1st
test run.
  • Loading branch information
iezer committed Dec 1, 2016
1 parent 8e9b383 commit 90624b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions addon/messages.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Ember from 'ember';

const { I18n } = Ember;

export default {
render(attribute, context) {
if (I18n) {
return I18n.t(`errors.${attribute}`, context);
// ember-i18n users may override this at runtime.
// jscs:disable disallowDirectPropertyAccess
if (Ember.I18n) {
return Ember.I18n.t(`errors.${attribute}`, context);
} else {
let regex = new RegExp('{{(.*?)}}');
let attributeName = '';
Expand Down

0 comments on commit 90624b7

Please sign in to comment.