# Addon Localization?

**URL:** <https://discuss.emberjs.com/t/addon-localization/7082>\
**Category:** Ember CLI\
**Created:** [January 14, 2015, 9:24pm UTC](https://discuss.emberjs.com/t/addon-localization/7082 "2015-01-14T21:24:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbuckner](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@jbuckner](https://discuss.emberjs.com/u/jbuckner)\
**Post date:** [January 14, 2015, 9:24pm UTC](https://discuss.emberjs.com/t/addon-localization/7082/1 "2015-01-14T21:24:17Z")

</div>

We’re currently building an Ember app within our Rails app, but moving toward an independent ember-cli environment. We’re trying to modularize our code with that intention so we’re building lots of small components that we can eventually turn into installable addons.

I’ve seen it’s possible to include CSS in an addon, but is it possible to include localization strings as part of an addon?

---

<div class="post-metadata">

**Author:** ![kgish](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kgish/32/13333_2.png) [@kgish](https://discuss.emberjs.com/u/kgish)\
**Post date:** [January 15, 2015, 2:27pm UTC](https://discuss.emberjs.com/t/addon-localization/7082/2 "2015-01-15T14:27:40Z")

</div>

Have a look at the `Brocfile.js` contents and using `app.import('/path/to/css')` on the fly depending on locale, hopefully that helps.

---

<div class="post-metadata">

**Author:** ![coladarci](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/coladarci/32/15090_2.png) [@coladarci](https://discuss.emberjs.com/u/coladarci)\
**Post date:** [May 25, 2015, 1:08am UTC](https://discuss.emberjs.com/t/addon-localization/7082/3 "2015-05-25T01:08:03Z")

</div>

Hey @jbuckner - did you end up making progress on this? I am embarking on the same journey. It seems like the addon’s `locales` contents need to be deep merged w/ the consuming app’s `locales` content and using one of the i18n libraries should ‘ **just work** ’

Seems reasonable… did you go down this path by any chance?

---

<div class="post-metadata">

**Author:** ![alienspaces](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/alienspaces/32/11315_2.png) [@alienspaces](https://discuss.emberjs.com/u/alienspaces)\
**Post date:** [August 31, 2015, 3:28am UTC](https://discuss.emberjs.com/t/addon-localization/7082/4 "2015-08-31T03:28:22Z")

</div>

Hello @jbuckner and @coladarci, Coincidentally I am also now contemplating various options for consuming intl resources from multiple addons into an app. Did either of you identify a manageable approach to this?

---

<div class="post-metadata">

**Author:** ![coladarci](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/coladarci/32/15090_2.png) [@coladarci](https://discuss.emberjs.com/u/coladarci)\
**Post date:** [August 31, 2015, 4:14am UTC](https://discuss.emberjs.com/t/addon-localization/7082/5 "2015-08-31T04:14:09Z")

</div>

Hey @alienspaces - yes - I’m really happy w/ what we’ve put together. Essentially, there are two pieces to it:

1. inside your addon, we’ve created an `en.js` file here: `app/locales/ember-cli-your-addon-name/en.js`. You place all your translations inside there.

2. also inside the addon, we’ve created an initializer that looks like this:

```auto
import Ember from 'ember';
import translations from '../locales/ember-cli-your-addon-name/en';

export function initialize() {
  if(!Ember.I18n.translations){
    Ember.I18n.translations = {};
  }
  Ember.I18n.translations['ember-cli-your-addon-name'] = translations;
  Ember.I18n.locale = 'en';
};

export default {
  name: 'ember-cli-your-addon-name-localizations',
  initialize: initialize
};

```

Note, with this approach, your translations are available at `t 'ember-cli-your-addon-name.foo'`

This is obviously a little rough, but hoping it can get you on the right path.

---

<div class="post-metadata">

**Author:** ![alienspaces](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/alienspaces/32/11315_2.png) [@alienspaces](https://discuss.emberjs.com/u/alienspaces)\
**Post date:** [August 31, 2015, 4:46am UTC](https://discuss.emberjs.com/t/addon-localization/7082/6 "2015-08-31T04:46:42Z")

</div>

Hello @coladarci, Thanks for the quick response! Your solution definitely provides food for thought.

---

<div class="post-metadata">

**Author:** ![coladarci](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/coladarci/32/15090_2.png) [@coladarci](https://discuss.emberjs.com/u/coladarci)\
**Post date:** [September 11, 2015, 3:15am UTC](https://discuss.emberjs.com/t/addon-localization/7082/7 "2015-09-11T03:15:24Z")

</div>

Just an FYI that this approach doesn’t work w/ the newest (awesome) version of ember-cli-i18n. Our approach has changed a little bit because of this. We are basically, in our parent app, pulling in the translations from the addon and adding them to our own translations (instead of pushing them from the addon, which would be better).
