Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Doc: Setting the Locale

James Alexander Rosen edited this page Jun 24, 2015 · 12 revisions

Setting the Locale

Set the default locale in config/environment.js:

ENV.i18n = {
  defaultLocale: 'zh'
};

Override the default by setting locale on the i18n service:

// app/routes/application.js

export default Ember.Route.extend({
  afterModel: function(user) {
    this.set('i18n.locale', user.get('locale'));
  }
});

Note: if you do this in an initializer and use FastBoot, you probably want to use an instance-initializer.