Skip to content

Organizing translations

Translations are stored in the translations folder, either as a *.json or *.{yaml,yml} file.

my-app
├── app
└── translations
my-v1-addon
├── addon
└── translations
my-v2-addon
├── src
└── translations

As the project grows, you will find the need to organize your translations. Here are a couple of ways to do so.

Nested folders

You may create subdirectories to organize your translations.

my-app
├── app
└── translations
    ├── components
    │   └── hello
    │       ├── de-de.yaml
    │       └── en-us.yaml
    └── routes
        └── application
            ├── de-de.yaml
            └── en-us.yaml

Each translation file should have a "namespace," an identifier that helps you localize the translations to that file.

yaml
components.hello:
  message: Hallo, {name}!
yaml
routes.application:
  title: Willkommen bei ember-intl

Namespaced keys

In ember-intl.config.mjs, set buildOptions.wrapTranslationsWithNamespace to true to derive the namespace from folder names.

yaml
message: Hallo, {name}!
yaml
title: Willkommen bei ember-intl

NOTE

Spaces in a folder name are converted to underscores.