Hi everyone,
I am implementing a plugin for Trados Studio 2015 that loads heavily customized bilingual xliff files. In some of the trans-units there are several segments for translation. I can easily load them into Trados, but then I get errors saying:
"SDL XLIFF Validation error at line 1 offset x: There is a duplicate key sequence y for the 'urn:oasis:names:tc:xliff:document:1.2:U_tu_segsrc_mid' key or unique identity constraint."
Understanding is quite clear. There are segments that have duplicate ID number. This can be confirmed in the sdlxliff itself:
<trans-unit id="5527283_55">
<source>Complete source</source>
<seg-source>
<mrk mtype="seg" mid="551">Segmented source 1 </mrk>
<mrk mtype="seg" mid="551">Segmented source 2</mrk>
</seg-source>
<target>
<mrk mtype="seg" mid="551">Translation of segmented source 1</mrk>
<mrk mtype="seg" mid="551">Translation of segmented source 2</mrk>
</target>
<sdl:seg-defs>
<sdl:seg id="551">
<sdl:rep id="G56VoLipD7qtJGeoxV9y2HZbcZA=" />
<sdl:value key="SegmentIdentityHash">G56VoLipD7qtJGeoxV9y2HZbcZA=</sdl:value>
</sdl:seg>
</sdl:seg-defs>
</trans-unit>
To mitigate this, I have tried to create custom Segment.Properties.Id and SegmentPair.Properties.Id. However I have found out, that no matter what I do, the Id's for all segments inside one ParagraphUnit will get overwritten by the ID of last segment, as soon as I add them to the respective collections.
I have even tried some post-processing:
int c=0;
foreach (var pair in paragraphUnit.SegmentPairs)
{
pair.Properties.Id = new SegmentId(xmlUnit.Attributes["id"] + "_" + c.ToString());
pair.Source.Properties.Id = new SegmentId(xmlUnit.Attributes["id"] + "_" + c.ToString());
pair.Target.Properties.Id = new SegmentId(xmlUnit.Attributes["id"] + "_" + c.ToString());
c++;
}
But in the end, all the segments inside will share the same Id, and it will be the Id of the last segment. I have tried both integer and string Id's. Is there any way how to overcome this?
Thanks,
Michal