Integrating formatjs.io and ember-cli


#1

Hello,

I’m looking into making an ember-cli addon adding idiomatic support for formatjs.io libraries. They’re already providing an integration with handlebars (handlebars-intl), so that part is done.

The part I’m struggling with is that the library assumes we’re doing something like

var template = Handlebars.compile(source);

var intlData = {
    locales: 'en-US'
}

var context = {
    price: 1000
};

var html = template(context, {
    data: {intl: intlData}
});

Usually, we’re never calling Handlebars.compile ourselves. So I’m wondering how I can properly “hook” into this process.

Thanks a lot for reading and for your help !


#2

Hi Kevin,

Nice to see you here ;). I’ve raised this issue here: https://github.com/yahoo/handlebars-intl/issues/53

What I’m going to try in the next few days is overriding the helper (when I register them as bound helper), and try to automatically pass the options that I would fetch from config.


#3

Hey : )

I’ve found a similar topic raised on the github issues of ember.js, cf here. For the moment I’m going to use ember-i18n which seems quite potent enough