jamesarosen/ember-i18n — pull request #106 by mphasize (2014-05-26 16:36:08+00:00)
Title: Make i18n.js play nicely with ember-cli (retry)

I ran into some issues when using ember-i18n with ember-cli. While the development mode with "ember serve" would work flawlessly, using "ember build --environment=production" would raise a couple of errors in the compiled output.

I tracked them down and modified my version of i18n.js --- here's the changes for everybody.
(I am using Ember 1.6 beta and ember-cli 0.0.28)

-----

Line 88: use `throw new Ember.Error` instead of undefined error function

Lines 163, 227, 228: use `Ember.Handlebars.registerHelper` instead of Handlebars.registerHelper. This makes Ember find the i18n helpers in the compiled output.

Lines 207, 221: use `Ember.Handlebars.SafeString` instead of vanilla Handlebars. This fixes wrongly escaped output.

One note: You will still need to include the vanilla Handlebars library. I was unable to get i18n.js to use the Ember.Handlebars.compile function (the check in line 82 returns false).
In the Brocfile.js (from ember-cli) add `app.import( 'vendor/handlebars/handlebars.js' );`

With these changes, ember-i18n still works as expected in a normal environment and now also works well in an ember-cli environment.

Cheers!
Marcus