Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Ember 2.1 Compatibility
Browse files Browse the repository at this point in the history
 * rely on helper lookup for `{{t}}` instead of manual registration
   for Ember 1.13+
 * use `container.registry` when it's available, falling back to the
   older, private `container._registry`
  • Loading branch information
James A. Rosen committed Aug 19, 2015
1 parent 340ffb5 commit 98371f4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 2 additions & 1 deletion addon/utils/add-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export default function addTranslations(locale, newTranslations, container) {
existingTranslations = {};
// CRUFT: there's no public API for registering factories at runtime.
// See http://discuss.emberjs.com/t/whats-the-correct-way-to-register-new-factories-at-runtime/8018
container._registry.register(key, existingTranslations);
const registry = container.registry || container._registry;
registry.register(key, existingTranslations);
}

Ember.merge(existingTranslations, newTranslations);
Expand Down
1 change: 1 addition & 0 deletions app/helpers/t.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-i18n/helper';
5 changes: 0 additions & 5 deletions app/instance-initializers/ember-i18n.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Ember from "ember";
import legacyHelper from "ember-i18n/legacy-helper";
import Helper from "ember-i18n/helper";
import ENV from '../config/environment';

export default {
Expand All @@ -17,9 +16,5 @@ export default {
if (legacyHelper != null) {
Ember.HTMLBars._registerHelper('t', legacyHelper);
}

if (Helper != null) {
instance.registry.register('helper:t', Helper);
}
}
};

0 comments on commit 98371f4

Please sign in to comment.