Important: #70867 - XLIFF whitespace handling now respects xml:space
See forge#70867
Description
TYPO3's XLIFF parser now properly respects the
xml: attribute
according to the XML specification (https://www.w3.org/TR/xml/#sec-white-space).
This affects how whitespace (spaces, tabs, newlines) in translation strings are handled.
Without
xml: (default behavior):
Multiple consecutive whitespace characters (spaces, tabs, newlines) are collapsed into a single space, and leading/trailing whitespace is trimmed.
Example XLIFF source:
<trans-unit id="my.label">
<source>This is a
multi-line
string.</source>
</trans-unit>
Before: The string contained literal newlines and indentation.
After: The string becomes
"This is a multi-
With
xml::
Whitespace is kept exactly as written in the XLIFF file.
<trans-unit id="my.label" xml:space="preserve">
<source>This is a
multi-line
string.</source>
</trans-unit>
The string remains
"This is a\
Impact
Translation strings that previously contained unintended whitespace (from formatting in the XLIFF file) will now display correctly without extra spaces or line breaks.
If you intentionally need preserved whitespace in a translation string,
add the
xml: attribute to the
<trans-
element (XLIFF 1.2) or
<segment> element (XLIFF 2.0).
This change affects both XLIFF 1.2 and XLIFF 2.0/2.1 formats.