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

Commit 90624b7

Browse files
committed
allow runtime override of Ember.I18n
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.
1 parent 8e9b383 commit 90624b7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

addon/messages.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Ember from 'ember';
22

3-
const { I18n } = Ember;
4-
53
export default {
64
render(attribute, context) {
7-
if (I18n) {
8-
return I18n.t(`errors.${attribute}`, context);
5+
// ember-i18n users may override this at runtime.
6+
// jscs:disable disallowDirectPropertyAccess
7+
if (Ember.I18n) {
8+
return Ember.I18n.t(`errors.${attribute}`, context);
99
} else {
1010
let regex = new RegExp('{{(.*?)}}');
1111
let attributeName = '';

0 commit comments

Comments
 (0)