I'm using the default i18n process for my Angular 4 project, so I use ng-i18n
to generate the .xlf
without problem.
But on my typescript code I also have some texts that need to be translated and retrieved by id for the current language.
I can't find any way to do that in Angular 4. Did I miss something ? I'm using AOT if that matter.
The problem can also occur if the server send back some message/error code from web services, how translate them with Angular
Currently it is not yet possible to translate with i18n from the typescript code.
"Angular only supports using i18n in your templates for now, I'm working on the feature that will allow you to use it in your code, but it's still a work in progress. This lib works both in code and templates" (Olivier Combe, Angular Core Team contractor)
Look at this discussion: https://github.com/ngx-translate/core/issues/495
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With