如何用Angular中的I18N翻译@Input?
我有一个具有自定义输入的组件,我称之为:
<app-button [color]="'black'"
[label]="'Manage'"
></app-button>
我想使用 i18n 来翻译此按钮的标签。我尝试了以下选项,没有任何运气:
<app-button [color]="'black'"
[label]="'Manage'"
i18n
></app-button>
<app-button [color]="'black'"
[label]="'Manage'"
i18n-label
></app-button>
<app-button [color]="'black'"
[label]="'Manage'"
i18n-[label]
></app-button>
有人知道如何实现自己想做的事情,模板侧吗?
I have a component with a custom input, which I call like this:
<app-button [color]="'black'"
[label]="'Manage'"
></app-button>
I want to translate the label of this button using i18n. I tried the following options, without any luck:
<app-button [color]="'black'"
[label]="'Manage'"
i18n
></app-button>
<app-button [color]="'black'"
[label]="'Manage'"
i18n-label
></app-button>
<app-button [color]="'black'"
[label]="'Manage'"
i18n-[label]
></app-button>
Does anyone have a clue on how I can achieve what I want to do, template-side?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚找到解决方案。
而不是用以下方式调用我的按钮:
我打电话给以下方式:
然后翻译出现在翻译文件中!
I just found a solution.
Instead of calling my button with:
I call it with:
And then the translation appears in the translation file!