带角度平移和ng复数化的AngularJS复数化
我有这段代码带角度平移和ng复数化的AngularJS复数化,angularjs,internationalization,angularjs-ng-pluralize,Angularjs,Internationalization,Angularjs Ng Pluralize,我有这段代码 <ng-pluralize count="comment.Comment.like_count" when="{'0': {{'LIKES_LIKE' | translate}}, 'one': {{'LIKES_LIKE' | translate}}, 'other': '{{'LIKES_LIKES' | translate}}}"> </ng-pluralize> 但是我不知道如何格式化字符串,以便它通过trans
<ng-pluralize count="comment.Comment.like_count"
when="{'0': {{'LIKES_LIKE' | translate}},
'one': {{'LIKES_LIKE' | translate}},
'other': '{{'LIKES_LIKES' | translate}}}">
</ng-pluralize>
但是我不知道如何格式化字符串,以便它通过translate过滤器实际解析likes字符串,以便ng pluralize指令接收解析的语言字符串
错误消息如下:
错误:[$parse:lexerr]Lexer错误:列处的引号未终止
107-123表达式[{'0':{{'LIKES_LIKE'|
翻译}},
‘一’:{{'LIKES|LIKE'| translate}},
'other':'{{'LIKES_LIKE'| translate}}}]
我很清楚我的意思,但我不知道如何让它起作用。有什么想法吗?这里的第一句话似乎没有结尾:
'{{{'LIKES\u LIKES'
建议删除它。我在寻找相同的答案,并提出了以下解决方案: 用“转义”转义翻译键的引号
<ng-pluralize count="comment.Comment.like_count"
when="{'0': '{{"LIKES_LIKE" | translate}}',
'one': '{{"LIKES_LIKE" | translate}}',
'other': '{{"LIKES_LIKES" | translate}}'}">
</ng-pluralize>
或者使用ng int value对象(也可以在控制器上定义这些值)
对于计数值的插值,可以使用
<ng-pluralize count="comment.Comment.like_count"
when="{'0': '{{LIKES_LIKE | translate}}',
'one': '{{LIKES_LIKE | translate}}',
'other': '{{LIKES_LIKES | translate:{count : comment.Comment.like_count} }}'}">
</ng-pluralize>
Where LIKES_LIKES=“{{count}}LIKES”
<ng-pluralize count="comment.Comment.like_count"
when="{'0': '{{LIKES_LIKE | translate}}',
'one': '{{LIKES_LIKE | translate}}',
'other': '{{LIKES_LIKES | translate:{count : comment.Comment.like_count} }}'}">
</ng-pluralize>