使用 AngularJS 的翻译指令翻译多个 translationId
Translating multiple translationIds using AngularJS's translation directive
我正在使用 PascalPrecht 的 AngularJS 翻译模块。
{
APP.WELCOME: 'Welcome',
APP.USER: 'user'
}
<span translate>{{'APP.WELCOME'}}</span> <span translate>{{'APP.USER'}}</span>
工作正常。它输出 Welcome user
.
现在,是否可以将两个 translationId 合并到一个元素中?我尝试了多种方法:
<span translate>{{'APP.WELCOME'}} {{'APP.USER'}}</span>
<span translate>{{'APP.WELCOME APP.USER'}}</span>
<span translate>{{'APP.WELCOME' + 'APP.USER'}}</span>
<span translate>{{'APP.WELCOME'; 'APP.USER'}}</span>
<span translate>{{['APP.WELCOME','APP.USER']}}</span>
但似乎没有任何效果。
有什么建议吗?这甚至可能吗?
尝试在单个 <span>
中使用两个双括号元素,并翻译为 $filter
:
<span>{{'APP.WELCOME' | translate }} {{ 'APP.USER' | translate }}</span>
它应该可以工作...
我正在使用 PascalPrecht 的 AngularJS 翻译模块。
{
APP.WELCOME: 'Welcome',
APP.USER: 'user'
}
<span translate>{{'APP.WELCOME'}}</span> <span translate>{{'APP.USER'}}</span>
工作正常。它输出 Welcome user
.
现在,是否可以将两个 translationId 合并到一个元素中?我尝试了多种方法:
<span translate>{{'APP.WELCOME'}} {{'APP.USER'}}</span>
<span translate>{{'APP.WELCOME APP.USER'}}</span>
<span translate>{{'APP.WELCOME' + 'APP.USER'}}</span>
<span translate>{{'APP.WELCOME'; 'APP.USER'}}</span>
<span translate>{{['APP.WELCOME','APP.USER']}}</span>
但似乎没有任何效果。
有什么建议吗?这甚至可能吗?
尝试在单个 <span>
中使用两个双括号元素,并翻译为 $filter
:
<span>{{'APP.WELCOME' | translate }} {{ 'APP.USER' | translate }}</span>
它应该可以工作...