我在应用程序中创建一些路线/ router.js如何在ember-cli中翻译路线?
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' });
});
});
但国际化翻译仅在第一次。
如何通过更改语言来翻译这些路线?
我使用:
烬-CLI:2.11.1
节点:7.4.0
ember-i18n:5.0.0
请阅读此页:http://xyproblem.info,然后小心地描述你愿意来实现。你所做的事情是非常错误的,所以我想听听你最初的目标,而不是你想达到的目标。 –
你想翻译URL中的路由名称吗?如果是的话,不要!这是一个非常糟糕的主意。 – Lux
@Lux,我试图翻译路线路径。 –