如何使用 Angular 2 ng-xi18n 工具转换属性

1 internationalization angular

可以像这样设置标签文本进行翻译: <h1 i18n>Welcome</h1>

占位符标签等属性如何设置? <input type="text" placeholder="Type your name" /><button type="submit" label="Send data"></button>(库primeng需要像这样设置按钮的标签)

非常感谢。

Bra*_*age 5

要翻译标记翻译placeholder属性,您可以添加一个i18n-placeholder属性,如下所示:

<input type="text" i18n-placeholder="@@type-your-name" placeholder="Type your name" />
Run Code Online (Sandbox Code Playgroud)

对于其他属性,它的工作方式相同:i18n-x,其中x是要翻译的属性的名称。

您也可以在此处找到的 Angular i18n 指南中找到答案。