Ember apps translation

I need to translate my Ember.js application. I've seen Ember-i18n, but I don't really like it approach. Writing something like

{{t user.edit.title}}

isn't very readable. I'd like better something more similar to the good old gettext, with .po files and so. Maybe something like this:

{{_}}Edit user{{/_}}

Is there any option I could use?

Upvotes: 0

Views: 231

Answers (1)

Robert Merten
Robert Merten

Reputation: 221

You might be able to use a combination of i18next and a handlebars helper.

Ember.Handlebars.helper('__', function(options) {
   var result = i18n.t(options.fn(this));
   return result;
});

{{#__}}Text to translate{{/__}}

Not entirely sure if that works, can't test it right now.

Upvotes: 2

Related Questions