Angular2 i18n for placeholder text

后端 未结 3 806
时光说笑
时光说笑 2021-02-12 13:25

Is there a way to translate the placeholder text for an input text field using Angular 2\'s i18n?

I

3条回答
  •  不要未来只要你来
    2021-02-12 14:18

    To add to the answer from @evandongen, here's where this is documented in the Angular docs:

    Updated link:

    https://angular.io/guide/i18n#translate-attributes

    Add i18n translation attributes


    To mark an attribute for translation, add an attribute in the form of i18n-x, where x is the name of the attribute to translate. The following example shows how to mark the title attribute for translation by adding the i18n-title attribute on the img tag:

    This technique works for any attribute of any element.

    You also can assign a meaning, description, and id with the i18n-x="|@@" syntax.

提交回复
热议问题