【发布时间】:2017-07-18 07:26:05
【问题描述】:
我在 app/router.js 中创建了一些路由
Router.map(function () {
let i18n = this.service('i18n');
this.route("lang", { path: '/:lang' }, function () {
this.route('home', { path: '/', template: 'home' });
this.route('about', { path: '/' + i18n.t('router.about'), template: 'about' });
this.route('locales', { path: '/' + i18n.t('router.locations'), template: 'locales' });
});
});
但 i18n 只翻译第一次。
如何通过更改语言翻译这些路线?
我正在使用:
ember-cli:2.11.1
节点:7.4.0
ember-i18n: 5.0.0
【问题讨论】:
-
请阅读此页面:xyproblem.info,然后仔细描述您愿意实现的目标。你的做法是非常错误的,所以我想听听你最初的目标,而不是你实现它的预期方法。
-
是否要翻译 URL 中的路由名称?如果是,不要!这是一个真的坏主意。
-
@Lux,我正在尝试翻译路线路径。
-
这是不可能的。为您的路径使用英文名称。
标签: ember.js internationalization ember-cli translate