Amal S R
Amal S R

Reputation: 930

How to handle repeated texts in Angular i18n translation

I am using angular 8 and i18n to translate a web application from English to Dutch. All the things are working fine. But i had a scenario that, a element <h4>Customer details</h4> is presented in customer-details.component.html, customer-form.component.html and users.component.html. In users.component.html, the same text Customer details is present in two times. I give i18n like i18n="Details of customer @@customerDetailsDetails", i18n="Details of customer @@customeFormsDetails". Now in messages.xlf1 file the same text Customer details is presented three times for translation. How can i handle these type of translation repetation ? Help me please.

Upvotes: 2

Views: 1378

Answers (1)

David
David

Reputation: 34455

Just give the same text and @@id in all your templates

i18n="Details of customer @@customerDetails

If you give a different ID, the translation will be there multiple times, even if the text is the same

Upvotes: 2

Related Questions