# Application-wide data such as currency and locale

**URL:** <https://discuss.emberjs.com/t/application-wide-data-such-as-currency-and-locale/6442>\
**Category:** Uncategorized\
**Created:** [October 7, 2014, 9:18pm UTC](https://discuss.emberjs.com/t/application-wide-data-such-as-currency-and-locale/6442 "2014-10-07T21:18:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![duizendnegen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/duizendnegen/32/9613_2.png) [@duizendnegen](https://discuss.emberjs.com/u/duizendnegen)\
**Post date:** [October 7, 2014, 9:18pm UTC](https://discuss.emberjs.com/t/application-wide-data-such-as-currency-and-locale/6442/1 "2014-10-07T21:18:38Z")

</div>

Hi all,

I’m writing an app which should be available in multiple languages (will look at the i18n plugins soon) and the prices displayed will be available in multiple currencies.

How would I go about saving this global information in a way that it’s accesible for all controllers. I’ve considered [Global Variable in Ember.js with local storage - Stack Overflow](http://stackoverflow.com/questions/21318130/global-variable-in-ember-js-with-local-storage) which I could do, but it feels rather strange to have to change all controllers for that.

Any tips or pointers are warmly welcomed.

---

<div class="post-metadata">

**Author:** ![duizendnegen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/duizendnegen/32/9613_2.png) [@duizendnegen](https://discuss.emberjs.com/u/duizendnegen)\
**Post date:** [October 8, 2014, 6:48am UTC](https://discuss.emberjs.com/t/application-wide-data-such-as-currency-and-locale/6442/2 "2014-10-08T06:48:18Z")

</div>

To answer my own question, I went with using intializers and injecting the language & currency into my controllers. [http://ember.zone/ember-application-initializers/](http://ember.zone/ember-application-initializers/)

Any feedback to the following piece is warmly welcomed.

```
Ember.Application.initializer({
	name: "currency",
	initialize: function(container, application) {
		application.register('user:currency', {
			_currency: 'EUR',
			currency: function(c) {
				if(c !== undefined && c !== null) {
					this._currency = c;
				}

				return this._currency;
			}
		}, {instantiate: false, singleton: true});
		application.inject('controller', 'currency', 'user:currency');
		application.inject('route', 'currency', 'user:currency');
	}
});

```
