My ember 1.8 app is built with grunt CLI and migrating to ember CLI isn't working out, but I'm upgrading to ember 1.10 so can use HTMLbars. The app uses ember-i18n so after loading and resolving models as it transitions to the first View, I get the error 'helper named 't' could not be found'. In 'vendor\ember-i18n\lib\i18n.js' I tried changing 'Handlebars.registerHelper' to 'Ember.HTMLBars._registerHelper', but then I get various 'is undefined' errors out of the i18n component. I read that i18n isn't supported in ember 1.9+ but I need it to work. How can I update it to work in 1.10?
Asked
Active
Viewed 359 times
0
-
Which version of `ember-i18n` are you using? I just looked at the latest source and it's using `Ember.Handlebars.registerBoundHelper` which should work just fine with 1.10. – Justin Niessner Mar 12 '15 at 00:01
-
Using lawitschka/ember-i18n.git#master v1.6.3 which is the last version from a year ago. It has "Handlebars.registerHelper('t', fn)". I also tried changing to use "Ember.Handlebars.registerBoundHelper()" but then I get errors from the 'attrs', 'data' and 'view' variables which follow (as I mentioned previously). So yes I guess that does get me past the 'register helper' problem, but I need the component to work after it gets registered. – bobvan Mar 12 '15 at 15:11
-
My version of the app running on ember 1.8.0 warns that 'Global lookup of Ember.I18n.translations from a Handlebars template is deprecated'. In my ember 1.10.0 version this doesn't work at all. The i18n component takes an 'options' param as it registers 't', then 'attrs' is set from 'options.hash'. When I console.out 'attrs' in the working version, it has a 't' object with references to several hbs templates which use the 't' helper. In the broken version, the 'options' object has very little in it and there's no 't' with references to templates at all. So am trying to figure out why that is. – bobvan Mar 12 '15 at 16:32
-
`ember-i18n` is up to release 2.9.1. I suggest you check out the releases page (https://github.com/jamesarosen/ember-i18n/releases ) and use a newer one. – Justin Niessner Mar 12 '15 at 17:11
-
Hmm, I see, yes our contractor built out the app with a (lawitschka) forked version of i18n for some reason. OK, so I changed to the master 'jamesarosen' version (3.0.0-beta.4) and now the app errors out much earlier as it transitions routes (Intermediate-transitioned into 'loading'). TypeError: Ember.I18n.set is not a function. Ember.I18n.set('translations', data). But I guess this is a good thing so will start investigating it from this point now. – bobvan Mar 12 '15 at 17:54
-
Our old forked version of i18n has additional params (pluralForm, isBinding, runAfterRender, compileTemplate) so will have to look into why these were needed. It also has many more objects within 'Ember.i18n' than the new/un-forked version, including the 'set' method which I'm missing now. So I changed "Ember.I18n.set('translations', data)" to "Ember.I18n.translations = data" and I have translations. With that solved, I'll now need to go through the various view helpers one-by-one and resolve whatever issues remain with global scope and data binding, etc. Thx. – bobvan Mar 12 '15 at 18:45
-
No problem. Glad that you were able to figure something out. If you have any other questions, feel free to post another question. – Justin Niessner Mar 12 '15 at 18:47
1 Answers
0
I hadn't realized that my i18n package, which hadn't been updated in a year, and doesn't support the latest Ember compiler, was a forked version (lawitschka). When I switched to the original project, which is up-to-date (jamesarosen), I was able to get my Locale 'label' setup working by changing 'Ember.I18n.set('translations', data)' to 'Ember.I18n.translations = data'.

bobvan
- 251
- 3
- 9