如果程序员不提供转换值,我希望在转换值中使用默认值。
例如,对于en.json
中的此键:
"NoRecordsWereFound": "No matching {{records}} were found for your search.",
在HTML中,当提供records
参数时,例如:
<span>
{{('NoRecordsWereFound' | translate:{ records: 'books' })}}
</span>
我将进入浏览器:
找不到找不到与您匹配的图书。
但是如果不提供参数,例如:
<span>
{{'NoRecordsWereFound' | translate}}
</span>
而不是得到这个: 没有匹配的 {{records}} 用于搜索。
我将为其获取一些默认值,例如:
未找到与您搜索相匹配的 defaultvalue 。
有可能吗?谢谢!