我在我的项目中使用angular-translate。我定义了一些关键字,比如:
{
"paging":{
"first":"First",
"last":"Last",
"next":"Next2",
"pre":"Previous"
}
}我使用它:
<uib-pagination first-text="{{'paging.first' | translate}}"
last-text="{{'paging.last' | translate}}"
next-text="{{'paging.next' | translate}}"
previous-text="{{'paging.pre' | translate}}">
</uib-pagination>我也在控制器的顶部使用$translatePartialLoader.addPart('module');,但当在浏览器中运行应用程序时,如下所示:

发布于 2016-05-11 17:54:22
为了进一步扩展我的评论并塑造一个答案,我认为不可能在翻译过滤器中使用名称空间。Related SO question。
另一种方法是首先使用$translate服务在控制器中生成转换,然后将值分配给$scope。例如:
$scope.firstText = $translate.instant('paging.first');然后..。
<uib-pagination first-text="{{ firstText }}"...我创建了一个到demonstrate this的原始插入器。
https://stackoverflow.com/questions/37158083
复制相似问题