0
votes

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?

1
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
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
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
ember-i18n is up to release 2.9.1. I suggest you check out the releases page (github.com/jamesarosen/ember-i18n/releases ) and use a newer one.Justin Niessner
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

1 Answers

0
votes

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'.