Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Doc: Migrating from ember cli i18n

Duke edited this page Dec 22, 2015 · 4 revisions

If you're coming from dockyard/ember-cli-i18n, the following list may be helpful. It's not necessarily comprehensive. If you find other changes, please add them here.

  1. for each language you support, move app/locales/xy.js to app/locales/xy/translations.js
  2. to set the default locale, in config/environment.js, set ENV.i18n = { defaultLocale: 'xy' };
  3. if you set the locale in an initializer, do container.lookup('service:i18n').set('locale', 'yz');
  4. change interpolations from ordered to named -- both in the template strings and in the invocations. Alternatively, see Doc: Translation Compiler for information about overriding the default compiler.
  5. in app code, inject service:i18n in any models, controllers, components, routes, and other objects that need translations: i18n: Ember.inject.service()
  6. in app code, change container.lookup('utils:t')('some.key') to this.get('i18n').t('some.key')