ember-i18n

How to set the i18n.locale from within an initializer

半世苍凉 提交于 2019-12-23 02:51:03
问题 I would like to set 'i18n.locale' from within an initializer in EmberJS. I am using 1.12 via Ember-CLI with ember-i18n. I tried this import Ember from 'ember'; export function initialize(container, application) { Ember.set('i18n.locale', 'de'); } export default { name: 'user-locale', initialize: initialize } but am receiving Assertion Failed: Path 'i18n.locale' must be global if no obj is given. 回答1: You could get i18n as service:i18n and use instance-initializer to set i18n.locale . //app

How to set the i18n.locale from within an initializer

喜欢而已 提交于 2019-12-06 15:48:51
I would like to set 'i18n.locale' from within an initializer in EmberJS. I am using 1.12 via Ember-CLI with ember-i18n. I tried this import Ember from 'ember'; export function initialize(container, application) { Ember.set('i18n.locale', 'de'); } export default { name: 'user-locale', initialize: initialize } but am receiving Assertion Failed: Path 'i18n.locale' must be global if no obj is given. artych You could get i18n as service:i18n and use instance-initializer to set i18n.locale . //app/instance-initializers/user-locale.js export function initialize(instance) { var i18n = instance