I have xlf files to translate my application. My app is set to English by default, I can also switch to a French version. The tree structure is as follows:
src/locale/
messages.en.xlf
messages.fr.xlf
messages.xlf
My angular.json is set like this:
{
"projects": {
"app": {
"i18n": {
"sourceLocale": {
"code": "en",
"baseHref": "/en/"
},
"locales": {
"fr": {
"translation": "src/locale/messages.fr.xlf",
"baseHref": "/fr/"
}
}
}
}
}
The translation is done in most cases, but there's one case where it's not and that drives me crazy, I must be missing something.
For example, here is a part of my html:
<ion-row *ngFor="let person of listOfPersons" (click)="doSomething(person)">
<div>
<ion-row>
<ion-col size="10.5">
<ion-row>
<ion-col class="title" size="4" i18n="fullname"> Firstname Lastname </ion-col>
<ion-col class="content" size="8" data-e2e="myfullname"> {{ person.firstName}} {{item.lastName}}
</ion-col>
</ion-row>
</ion-col>
</ion-row>
</div>
</ion-row>
And here is my messages.fr.xlf
<trans-unit id="XXX" datatype="html">
<source> Firstname Lastname </source>
<target>Nom/Prénom</target>
<context-group purpose="location">
<context context-type="sourcefile">src/.../my.page.html</context>
<context context-type="linenumber">22</context>
</context-group>
<note priority="1" from="description">fullname</note>
</trans-unit>
And my messages.en.xlf and messages.xlf are exactly the same without the target tag.
In the French version, I have "Nom/Prénom" which is correct.
Now, I want to change "Firstname Lastname" by "Lastname", so I did it everywhere there was "Firstname Lastname" (html file + the 3 xlf).
The French version is now showing Lastname instead of "Nom/Prénom", and I don't know what I'm doing wrong.
I tried all combinaisons, but I didn't get it working. Everything seems correct to me, I even added line number (which corresponds) so I don't get it.
Thanks for your help
EDIT: I tried something else. I replaced "Firstname Lastname" by "Lastname", except in HTML where I kept "Firstname Lastname" -> French version is showing "Nom/Prénom" which is correct, how is it possible? Same thing, if I put "Lastname" in my HTML, I get "Lastname" in French version instead of "Nom/Prénom".
It seems that all my messages.xlf are bypassed, and of course there are no others "Firstname Lastname" in my project.