[Translation] Added segment-attributes metadata for Xliff2 files to preserve the `state´ attribute of translations #58205
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The XliffFileLoader and XliffFileDumper create/parse a "target-attributes" metadata array, for additional attributes on the target XML element. This allowed to read/write the translation state of xliff1.2 files.
In xliff2.0 however, the state attribute is not stored at the target element, but on the "segment" element instead (see xliff 2.0 specification). Therefore, currently, the state information (and other information stored there) is lost when loading a xliff2.0 file and writing the catalog back.
This pull requests add a new "segment-attributes" metadata, which contains the attributes of the "segment" element, and allows preserving this information and also allows accessing it inside an application via the metadata.