Docs / Ember
Ember i18n with ember-intl, automated
Localize an Ember app: Glimmer templates (.hbs, .gjs, .gts) become ember-intl {{t}} calls, with plurals, and an application route that picks the language.
How it works
Template text becomes {{t "key" name=this.user.name}}, attributes placeholder={{t "key"}}, and {{if (eq n 1) "item" "items"}} in a sentence a plural message.
Before and after
The engine’s real output for this file. In a real run, the hosted model names the keys from context.
app/templates/cart.hbs · before
<h1>Your basket</h1>
<p>Hi {{this.user.name}}, you have {{@count}} new messages.</p>
<p>See the <a href="/faq">FAQ</a> before you order.</p>
<input placeholder="Search products" />app/templates/cart.hbs · after
<h1>{{t "cart.your_basket"}}</h1>
<p>{{t "cart.hi_you_have_new_messages" name=this.user.name count=@count}}</p>
<p><I18nT @key="cart.see_the_before_you_order" @slots="a" as |is|>{{#if is.a}}<a href="/faq">{{t "cart.faq"}}</a>{{/if}}</I18nT></p>
<input placeholder={{t "cart.search_products"}} />translations/en.json
{
"cart": {
"your_basket": "Your basket",
"hi_you_have_new_messages": "Hi {name}, you have {count} new messages.",
"faq": "FAQ",
"see_the_before_you_order": "See the {a} before you order.",
"search_products": "Search products"
}
}What the setup adds
The first run sets up ember-intl if the project doesn’t have it yet:
ember-intl, with messages intranslations/<locale>.json- An application route that picks the language and sets
<html lang dir>
Run it
The CLI needs Node.js 22 or later.
npm install --save-dev localize-dev
npx localize-dev login
# Preview, then write the changes
npx localize-dev run --dry-run -l es,fr,de
npx localize-dev run -l es,fr,de
# Or open a pull request instead
npx localize-dev pr -l es,fr,deOr add the GitHub Action and get a pull request on every push. Try it on your own code first in the playground.