k.vincent
k.vincent

Reputation: 4143

Is there a way to translate dynamic content used as interpolation - Internationalization i18n?

I'am using the i18n internationalization for an application and I do have in some components a dynamic messages and text which is being dynamically embedded in the HTML via interpolation.

e.g. here I would like to provide a translation for the variable {{errorMessage}}

....
err => {
   this.errorMessage = 'Please check your credentials...!';
}
....

Is there a way to use/add the translation for this kind of content in the translation files: messages.es.xlf and messages.fr.xlf?

I have been searching and it seems to not be available or at least possible in the actual status/stage of i18n development... i18n: Able to use translation strings outside a template

Upvotes: 0

Views: 1997

Answers (1)

k.vincent
k.vincent

Reputation: 4143

Issue solved. The translation for dynamic content is being added in message.*.xlf files straightforward when running: ng xi18n. It adds following for dynamic text interpolation e.g. <source><x id="INTERPOLATION" equiv-text="{{ myDynamicText }}"/></source>

Upvotes: -1

Related Questions