[英]translate attribute values with ngx-translate angular
I am trying to use ngx-translate for attribute values like p-messages text, p-column header, p-tabPanel header 我正在尝试将ngx-translate用于诸如p-messages文本,p-column标头,p-tabPanel标头的属性值
<p-message text="text"></p-message>
<p-column header="text"></p-column>
<p-tabPanel header="text">
I tried the following but it doesn't work: 我尝试了以下操作,但不起作用:
<p-tabPanel header="'key' | translate">
<p-tabPanel header="{{'key' | translate}}">
<p-tabPanel [attr.header]="'key' | translate">
Is there any way to use ngx-translate for these? 有什么办法可以使用ngx-translate吗?
From this github issue 从这个github问题
<img src="image.jpg" [attr.alt]="'key' | translate"> or like this:
<input placeholder="{{'key' | translate}}">
The following solution worked: 以下解决方案有效:
<p-tabPanel header="{{'key' | translate}}">
But be very careful to import TranslateModule in the needed module. 但是要非常小心,在所需的模块中导入TranslateModule。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.