Skip to content
Francesco Novy edited this page Nov 20, 2018 · 2 revisions

ember-l10n provides a GNU gettext based localization workflow for ember.

Installation

ember install ember-l10n

See Configuration options for how to configure ember-l10n for your needs.

Usage in templates

{{t 'This is the English string.'}}
{{n 'One item' '{{count}} items' count}}

See Usage in templates

Usage in JS

export default Component.extend({
  l10n: service(),

  text: computed(function() {
    this.l10n.t('Translate this');
  })
});

See Usage in JavaScript files

Extraction of strings

You can extract all your strings from your app into .pot/.po files, which are ready to be translated by your translators!

ember l10n:extract

See CLI: Extracting translations

Then later, you can convert your translated .po files back into the necessary JSON format for ember-l10n:

ember l10n:convert --language 'de'

See CLI: Converting to JSON