Skip to content

Commit 32d8949

Browse files
Fix and improve XLIFF state handling (#6177)
- Fix embedded examples - State attribute must be on the segment tag in XLIFF 2.x - Add note about omitted attributes Related: https://review.typo3.org/c/Packages/TYPO3.CMS/+/91482 Releases: main
1 parent 15b3bc5 commit 32d8949

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

Documentation/ApiOverview/Localization/XliffFormat.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ Sample XLIFF translation files
113113

114114
.. versionadded:: 14.0
115115

116-
.. literalinclude:: _snippets/_example_xliff_2.0.xlf
116+
.. literalinclude:: _snippets/_de.example_xliff_2.0.xlf
117117
:language: xml
118118
:caption: EXT:my_extension/Resources/Private/Language/de.locallang.xlf
119119

120-
In XLIFF 2.0, the approval status of a translation is defined by the
121-
:xml:`state` attribute on the :xml:`<target>` element.
120+
In XLIFF 2.x, the approval status of a translation is defined by the
121+
:xml:`state` attribute on the :xml:`<segment>` element.
122122
Common values are:
123123

124124
`initial`
@@ -134,11 +134,11 @@ Sample XLIFF translation files
134134
Final, approved translation ready for use.
135135

136136
TYPO3 treats translations with :xml:`state="reviewed"` or
137-
:xml:`state="final"` as approved.
137+
:xml:`state="final"` on the :xml:`<segment>` tag as approved.
138138

139139
.. group-tab:: XLIFF 1.2
140140

141-
.. literalinclude:: _snippets/_example_xliff_1.2.xlf
141+
.. literalinclude:: _snippets/_de.example_xliff_1.2.xlf
142142
:language: xml
143143
:caption: EXT:my_extension/Resources/Private/Language/de.locallang.xlf
144144

@@ -151,8 +151,12 @@ language is stored in an additional file.
151151

152152
By default, TYPO3 considers only approved translations for both XLIFF 1.2 and 2.x:
153153

154-
- XLIFF 1.2: :xml:`approved="yes"` or missing attribute
155-
- XLIFF 2.x: :xml:`state="reviewed"` or :xml:`state="final"`
154+
- XLIFF 1.2: :xml:`approved="yes"` on the :xml:`<trans-unit>` tag
155+
- XLIFF 2.x: :xml:`state="reviewed"` or :xml:`state="final"` on the :xml:`<segment>` tag
156+
157+
.. note::
158+
TYPO3 considers translations as approved if the :xml:`approved` attribute
159+
(in XLIFF 1.2) or the :xml:`state` attribute (in XLIFF 2.x) is omitted.
156160

157161
To also include unapproved translations
158162
(for example :xml:`approved="no"` or :xml:`state="translated"`),

Documentation/ApiOverview/Localization/_snippets/_de.example_xliff_2.0.xlf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<xliff version="2.0" xmlns="urn:oasis:names:tc:xliff:document:2.0" srcLang="en" trgLang="de">
33
<file id="f1">
44
<unit id="headerComment">
5-
<segment>
5+
<segment state="final">
66
<source>The default Header Comment.</source>
7-
<target state="final">Der Standard-Header-Kommentar.</target>
7+
<target>Der Standard-Header-Kommentar.</target>
88
</segment>
99
</unit>
1010
<unit id="generator">
11-
<segment>
11+
<segment state="final">
1212
<source>The "Generator" Meta Tag.</source>
13-
<target state="final">Der "Generator"-Meta-Tag.</target>
13+
<target>Der "Generator"-Meta-Tag.</target>
1414
</segment>
1515
</unit>
1616
</file>

0 commit comments

Comments
 (0)