#/mapping/date.js
import { translationMacro as t } from "ember-i18n";
export default {
i18n: Ember.inject.service(),
DateFilter: {
today: "Today",
yesterday: "Yesterday",
thisWeek: "This Week",
lastWeek: "Last Week",
thisMonth: "This Month",
lastMonth: "Last Month",
none: "None"
}我已经尝试使用helper作为{{t "Today"}},宏作为(t "Today")和服务注入作为this.get('i18n').t( 'Today‘).toString(),其中’Today‘是一个键,但它们都不起作用。另外,如何翻译.scss文件中的字符串?例如,下面代码中的“打开文件”。
&::after{
position: absolute;
content: 'Open file';
font-size: 12px;
color: $secondary-button;
bottom: 16px;
left: 16px;
} 发布于 2018-07-11 15:20:39
除非您指定"Today“作为your-locale/translation.js中的一个键,否则这将不起作用。
我猜您可能希望在{{t}}帮助器中使用属性,而不是硬编码的字符串。使用{{t DateFilter.today}}。DateFilter.today是一个控制器属性,它将返回字符串'today‘
https://stackoverflow.com/questions/48985410
复制相似问题