ember-intl

The preset for ember-intl. It reads the t helper in Handlebars and template-tag files, and intl.t in code.

The ember-intl preset supports ember-intl.

Detection

The preset applies when the project depends on ember-intl.

x18n.config.ts
import { emberIntl } from '@x18n/cli/presets'
import { defineConfig } from '@x18n/core'

export default defineConfig({
  presets: [emberIntl()],
})

Locale files

If your config has no resources, the preset uses translations/{locale}.{ext} and translations/{namespaces}/{locale}.{ext}.

Supported syntax

In .hbs, .gjs and .gts files, the preset reads the t helper, as a mustache and as a subexpression:

app/templates/a.hbs
<h1>{{t 'a.b'}}</h1>
<p>{{concat (t 'a.c') '!'}}</p>

In JS and TS files, intl.t is a translate call, also as this.intl.t.

Placeholders

ICU MessageFormat, as for next-intl.

Extraction templates

KindsFilesTemplate
any**/*.hbs{{t '{key}'}}
js-string, js-templateanythis.intl.t('{key}'{args})