Closed wake42 closed 2 years ago
@wake42 Good day
In order to translate attribute you can use i18next pipe as you would use any other pipe in attribute binding
<p [title]="'how to translate this?' | i18next ">
or
<p [attr.title]="'how to translate this?' ' | i18next ">
If 'how to translate this?' is a dynamic value of course you would need to set it up in .ts
extract translations from ts & html to json files
What do u mean by that?
i18next has some parsing tools, u can check it out on their official website:
Thanks for your reply. And the first part of my questions works fine.
I did have a look at those extraction tools, but since translation keys are passed to angular pipes I didn't see how they could be extracted. They all seem to assume the keys are specified either as a parameter to the t
function or as html attributes like data-i18n
see https://github.com/i18next/i18next-parser#html The translations that go though the t
function should work, but do you know of any translation extractor that could parse "myKey" | i18next
from html?
@wake42 No, i didn't know about that kind extractors
Hi, I'm looking at using this library, but I can't see any example of translating attributes (like
<p title="how to translate this?"></p>
) is there a way to do that without preparing the translation in the ts file and passing that down to the html?Also I'm looking for a way to extract translations from ts & html to json files, but don't see any that handle the pipes in html files - do you have any suggestions?