0

I am in the process of using i18n to add translation to my project but I have a problem with trying to apply this technique to an input box with a placeholder that is dynamically determined by a pipe:

<input
  i18n-placeholder="@@testPlaceholder"
  placeholder={{'text to be transformed here by pipe'} | PipeFormatter}}
/>

where PipeFormatter is a custom pipe i have created to transform the text based on requirements.

How would I be able to provide the translation for the placeholder in this instance?

  • You can use you pipe inside your component. See [this answer](https://stackoverflow.com/a/35152297/10122791) – Augustin R Aug 23 '18 at 13:21
  • 1
    Have you tried using ngx-translate? The docs mos tlikely will explain what to do: https://github.com/ngx-translate/core. You could do your translate magic inside your custom pipe. – gerb0n Aug 23 '18 at 13:22
  • I was looking at ngx-translate but i was wondering if there was any way to do it using the i18n tools? For example, I can use the translate select feature to do the following e.g: where object.label is the value to be checked and the following parts after the select are all possible values. Can this be done for the placeholder template in the HTML code? – AmeBaathHai Aug 23 '18 at 13:29

0 Answers0