microsoft / XLIFF2-Object-Model

If you’re looking to store localization data and propagate it through your localization pipeline allowing tools to interoperate then you may want to use the XLIFF 2.0 object model. The XLIFF 2.0 object model implements the OASIS Standard for the XLIFF 2.0 specification as defined at http://docs.oasis-open.org/xliff/xliff-core/v2.0/xliff-core-v2.0.html.
Other
86 stars 25 forks source link

Adding a Generic MarkedSpan element inside a Comment MarkedSpan element will change the type to "comment" #9

Closed lziman closed 8 years ago

lziman commented 8 years ago

Adding a marked span element with default type (generic) into a marked span element with type="comment" will change the type from generic to comment:

Expected result:

<source><mrk id="m1" type="comment" value="This is a comment marked span element">marked <mrk id="m2" type="generic" translate="yes">marked span</mrk>span</mrk></source>

Actual result: ult:

<source><mrk id="m1" type="comment" value="This is a comment marked span element">marked <mrk id="m2" type="comment" translate="yes">marked span</mrk>span</mrk></source>

When serializing the document, the library will throw an error because the marked span element transfomed into comment does not contain "value" or "ref" attribute.

If we add a marked span with default type or "generic" inside a marked span element with type="comment" it shouldn't change the type from "generic" to "comment".

RyanKing77 commented 8 years ago

We cannot reproduce this issue. Can you please provide the snippet of code you are using to serialize the document?

lziman commented 8 years ago

Creating a default MarkedSpan element which has the type="generic" and adding it to a MarkedSpan element with type="comment" will change the type of the added MarkedSpan from generic to comment.

var markedSpanComment = new MarkedSpan("mrk1") { Type = MarkedSpanTypes.Comment, Value = "marked span comment" };

var markedSpan = new MarkedSpan("mrk2");

markedSpanComment.Text.Add(markedSpan);

And this also happens when deserializing a document, see attached file. Validator throws an exception because the MarkedSpan with id="m3" does not have Reference or Value set but the file is valid and the MarkedSpan is a valid generic MarkedSpan.

Because the ".xlf" file extension is not supported when uploading a document, I changed it to ".txt"

https://github.com/Microsoft/XLIFF2-Object-Model/files/111844/defaultMarkerInsideCommentMarke

RyanKing77 commented 8 years ago

Thank you for the additional information. We'll take a look and get back to you.

RyanKing77 commented 8 years ago

We have reproduced the issue and are preparing a fix. Thanks.

RyanKing77 commented 8 years ago

We have released this fix. Thanks for reporting it!