ember-i18n did not find a default locale; falling back to "en"

628 Views Asked by At

I am getting this warning for ember-i18n (ember-i18n: 5.0.0)

I have set in defaultLocale: 'en' (As mensioned in ember-i18n docs) in environment.js but still its populationg warning.

//environment.js

module.exports = function(environment) {
    var ENV = {
        modulePrefix: 'spotlight',
        environment: environment,
        baseURL: '/',
        locationType: 'auto',
        EmberENV: {
           FEATURES: {}
        }, 

        APP: {
           defaultLocale:'en',
        }
    };
    if (environment === 'development') {
        ENV.APP.RAISE_ON_DEPRECATION = true;
    }

    if (environment === 'test') {
       ENV.baseURL = '/';
       ENV.locationType = 'auto';
       ENV.APP.LOG_ACTIVE_GENERATION = false;
       ENV.APP.LOG_VIEW_LOOKUPS = false;
       ENV.APP.rootElement = '#ember-testing';
    }
    if (environment === 'production') {}

    ENV.i18n = { defaultLocale: 'en' };
    return ENV;
};

//package.json

{
  "devDependencies": {
      "ember-i18n": "5.0.0"
  }
}

//app/initializer/i18n.js

import Ember from 'ember';

export default {
    name: 'i18n',
    after: 'ember-i18n',
    initialize: function()
    {
        var application = arguments[1] || arguments[0];
        application.inject('controller', 'i18n', 'service:i18n');
        application.inject('route', 'i18n', 'service:i18n');
    }
}

Thanks in advance for help.

1

There are 1 best solutions below

0
On BEST ANSWER

Got it. It was because of home.jsp (my project init file) static meta content.

It was always setting with static meta content (home.js meta content) instead of environment.js file.

<meta name="spotlight/config/environment" content="%7B%22modulePrefix%22%3A%22spotlight%22%2C%22environment%22%3A%22development%22%2C%22baseURL%22%3A%22%2F%22%2C%22locationType%22%3A%22hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%7D%2C%22i18n%22%3A%7B%22defaultLocale%22%3A%22en%22%7D%2C%22APP%22%3A%7B%22LOG_RESOLVER%22%3Atrue%2C%22LOG_ACTIVE_GENERATION%22%3Atrue%2C%22LOG_TRANSITIONS%22%3Atrue%2C%22LOG_TRANSITIONS_INTERNAL%22%3Atrue%2C%22LOG_VIEW_LOOKUPS%22%3Atrue%2C%22LOG_BINDINGS%22%3Atrue%2C%22RAISE_ON_DEPRECATION%22%3Atrue%2C%22LOG_STACKTRACE_ON_DEPRECATION%22%3Atrue%7D%2C%22contentSecurityPolicyHeader%22%3A%22Content-Security-Policy-Report-Only%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%22%2C%22script-src%22%3A%22%27self%27%20%27unsafe-eval%27%22%2C%22font-src%22%3A%22%27self%27%22%2C%22connect-src%22%3A%22%27self%27%22%2C%22img-src%22%3A%22%27self%27%22%2C%22style-src%22%3A%22%27self%27%22%2C%22media-src%22%3A%22%27self%27%22%7D%2C%22exportApplicationGlobal%22%3Atrue%7D">