Open simonexmachina opened 10 years ago
@aexmachina we're still sorting out some of the details, and some of it might end up in a new project that uses i18nliner-handlebars as its foundation (maybe i18nliner-ember?). In the meantime it should be possible to make it work with a little bit of duct tape...
You'll need to hook into ember-cli's handlebars compilation so that i18nliner's pre-processor can do its thing. I haven't dug into it too much to know where, but the gist of it is you need to give EmberHandlebars a pre-processed AST rather than the source string, e.g.
// somewhere inside ember-cli / ember-template-compiler ... assuming we have a `source` var
var Handlebars = require('handlebars');
var ast = Handlebars.parse(source);
var PreProcessor = require('i18nliner-handlebars/dist/lib/pre_processor')['default'];
PreProcessor.process(ast);
var result = EmberHandlebars.precompile(ast).toString();
// do whatever you usually do with result
So yeah, it takes a little bit to wire everything up, but it's not too terrible. I'm using i18nliner in three different ember apps atm, but none of them uses ember-cli (one broccoli, one grunt, and one franken-guard). We'll definitely be improving this in the near term, so watch this space. I'll post some updates and close this ticket once the plan solidifies a bit more.
Happy to help out, just want to know how I should approach it.