我在應用程序中創建一些路線/ 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,我試圖翻譯路線路徑。 –