formatjs / handlebars-intl

Handlebars helpers for internationalization.
http://formatjs.io/handlebars/
Other
265 stars 28 forks source link

intlGet could not find Intl object #69

Closed itsmatthu closed 8 years ago

itsmatthu commented 8 years ago

Hi When I tried to use FormatJS with RequireJS, I encounter this problems. my code is like: in a.hbs {{intlGet "a"}} in a.js this.$el.html(this.template(this.model.toJSON(),{data:{intl:{"a":"b"}}}));

I got an error : could not find Intl object "a". And I track the error, I found in handlebars-intl.js intlGet is a function with 2 variables. function intlGet(path, options){...}

So when I track in it, i found options are empty object.It lead to the error. How should I setting this options if it can't be parse by this.template({},options)?

caridy commented 8 years ago

make sure you're loading the intl polyfill: https://github.com/andyearnshaw/Intl.js#getting-started

itsmatthu commented 8 years ago

right now I'm using Chrome on OS X, so I assume it is not necessary for now. right?

itsmatthu commented 8 years ago

thank you for helping, I found my project using a legacy version of handlebars.js. update to 2.0+ will fix this.