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

Doc: Defining Translations

James Alexander Rosen edited this page Jun 24, 2015 · 9 revisions

Defining Translations

Put translation files in app/locales/[locale]/translations.js. Each file should export an object. If the values are Functions, they will be used as-is. If they are Strings, they will first be compiled using util:i18n/compile-translation. A default Handlebars-like implementation is provided. See Recipe: Overriding Translation Compiler for more information on overriding the compiler.

For example,

export default {
  'user.edit.title': 'Edit User',
  'user.followers.title.one': 'One Follower',
  'user.followers.title.other': 'All {{count}} Followers',

  // nested objects work just like dotted keys
  'button': {
    'add_user': {
      'title': 'Add a user',
      'text': 'Add',
      'disabled': 'Saving...'
    }
  }
};

The locale generator will generate a new translations file for you:

$ ember generate locale es