# Ember-pikaday localization

**URL:** <https://discuss.emberjs.com/t/ember-pikaday-localization/14930>\
**Category:** Uncategorized\
**Created:** [June 13, 2018, 3:38pm UTC](https://discuss.emberjs.com/t/ember-pikaday-localization/14930 "2018-06-13T15:38:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![belgoros](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/belgoros/32/16101_2.png) [@belgoros](https://discuss.emberjs.com/u/belgoros)\
**Post date:** [June 13, 2018, 3:38pm UTC](https://discuss.emberjs.com/t/ember-pikaday-localization/14930/1 "2018-06-13T15:38:10Z")

</div>

Can anybody explain how to use a locale that is set up globally in an initializer as follows:

```auto
#initializers/i18n.js

export function initialize(applicationInstance) {
  let i18n = applicationInstance.lookup('service:i18n');
  let moment = applicationInstance.lookup('service:moment');
  let locale = calculateLocale(i18n.get('locales'));
  i18n.set('locale', locale);
  moment.setLocale(locale);
}

function calculateLocale(locales) {
  // whatever you do to pick a locale for the user:
  const language = navigator.languages[0] || navigator.language || navigator.userLanguage;

  return locales.includes(language.toLowerCase()) ? language : 'en-GB';
}

export default {
  name: 'i18n',
  initialize
};

```

in `ember-pikaday` add-on ? I tried to follow the steps in their [README](https://github.com/edgycircle/ember-pikaday/blob/master/README.md#localization) without success. Thank you.
