Reputation: 139
I use i18n angular for internationalization application.
I want to translate a string except the one word in the middle of the string.
In practice this word could be the abbreviation or the name of the company.
(e.x. translate from English to Spanish)
English:
'This is a test Message for translation.'
Spanish (Actual result) :
'Este es un mensaje de prueba para traducción.'
Spanish (expected result):
'Este es un Message de prueba para traducción.'
I have the only one solution - wrap string to the separated span:
<span i18n="Test part1: This is a test@@TestPart1"> This is a test </span>
<span>Message</span>
<span i18n="Test part2: for translation@@TestPart2">for translation</span>
Do someone has a more convenient or common solution?
Thanks.
Upvotes: 1
Views: 1117
Reputation: 12196
I believe you can use interpolation inside of i18n string
<span i18n="@@Test"> This is a test {{msgStr}} for translation</span>
and it would be transformed into a string with interpolation in the middle
<source> This is a test <x id="INTERPOLATION" equiv-text="{{msgStr}}" /> for translation</source>
<target state="final"> Este es un <x id="INTERPOLATION" equiv-text="{{msgStr}}" /> de prueba para traducción. </target>
Upvotes: 1