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 26 forks source link

Validator rejects <mrk> tags without the "translate" attribute #12

Closed ghost closed 8 years ago

ghost commented 8 years ago

When an XLIFF 2.0 file contains a <mrk> tag without the "translate" attribute, the validator sees it as invalid, throwing the error: "System.FormatException: A value for translate must be specified".

According the official specification, the translate attribute is optional in <mrk>, so the attached file should be valid. It also passes validation by http://okapi-lynx.appspot.com/validation.

This only started happening after the last commit, it wasn't an issue before that.

markedSpan.xlf.txt

ghost commented 8 years ago

Actually the problem applies only to marked spans with custom types, as is the case in the attached file. See http://docs.oasis-open.org/xliff/xliff-core/v2.0/xliff-core-v2.0.html#annotations.

ghost commented 8 years ago

Looks like the fix is simple, the conditions in methods IOutputResolver.IsOutputRequired() of classes MarkedSpan and MarkedSpanStart should be changed to the following:

if (property == AttributeNames.Translate) { return this.Type == MarkedSpanTypes.Generic; }

ghost commented 8 years ago

Created a pull request with the fix: https://github.com/Microsoft/XLIFF2-Object-Model/pull/14.

RyanKing77 commented 8 years ago

Merged pull request #14. Thanks for the contribution!

ghost commented 8 years ago

Thanks as well!