我收到了ember-i18n (ember i18n: 5.0.0)的警告
我已经在environment.js中设置了defaultLocale:'en‘(在ember-i18n文档中提到),但仍然是它的填充警告。
//environment.js ment.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');
}
}提前感谢您的帮助。
发布于 2017-02-27 22:24:16
明白了。这是因为home.jsp (我的项目初始化文件)静态元内容。
它总是使用静态元内容(home.js元内容)而不是environment.js文件进行设置。
<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">https://stackoverflow.com/questions/42412222
复制相似问题