Skip to content

Commit a7fad87

Browse files
linawolfbrotkrueml
andauthored
[FEATURE] Support for XLIFF 2.0 translation files (#6113)
* [FEATURE] Support for XLIFF 2.0 translation files Resolves: TYPO3-Documentation/Changelog-To-Doc#1368 Releases: main * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> * Apply suggestion from @brotkrueml Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com> --------- Co-authored-by: Chris Müller <2566282+brotkrueml@users.noreply.github.com>
1 parent d011fd2 commit a7fad87

File tree

13 files changed

+366
-222
lines changed

13 files changed

+366
-222
lines changed
Lines changed: 83 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
1+
:navigation-title: Translation management
2+
13
.. include:: /Includes.rst.txt
24
.. index:: Localization; Manage translations
35
.. _managing-translating:
46

5-
=====================
6-
Managing translations
7-
=====================
7+
==============================
8+
Managing translations in TYPO3
9+
==============================
810

9-
This sections highlights the different ways to translate and manage XLIFF files.
11+
This section highlights the different ways to translate and manage TYPO3
12+
language files (XLIFF 1.2 and 2.x).
1013

14+
.. contents:: Table of contents
1115

1216
.. index:: Localization; Fetch translations
1317
.. _xliff-translating-fetch:
1418

15-
Fetching translations / updating language packs
16-
===============================================
19+
Fetching translations or updating language packs
20+
================================================
1721

1822
The backend module :guilabel:`Admin Tools > Maintenance > Manage Language Packs`
19-
displays a list of available languages to your users and can fetch and
20-
update language packs in TER and Core extensions from the official translation server.
21-
The module is rather straightforward to use and should be pretty much self-explanatory.
22-
Downloaded language packs are stored in the environment's
23-
:ref:`Environment-labels-path`.
23+
displays a list of available languages and can fetch or update language packs
24+
for system and extension translations from the official TYPO3 translation server.
2425

25-
.. include:: /Images/AutomaticScreenshots/AdminTools/ManageLanguagePacks.rst.txt
26+
The module is straightforward to use. Downloaded language packs are stored in the
27+
environment’s :ref:`Environment-labels-path`.
2628

29+
.. include:: /Images/AutomaticScreenshots/AdminTools/ManageLanguagePacks.rst.txt
2730

2831
Language packs can also be fetched using the command line:
2932

@@ -43,14 +46,14 @@ Language packs can also be fetched using the command line:
4346
4447
.. _load-language-pack:
4548

46-
Load an additional language pack
47-
================================
49+
Loading an additional language pack
50+
===================================
4851

49-
Additional language packs can be installed by administrators in the backend:
52+
Administrators can install additional language packs directly in the backend:
5053

5154
.. rst-class:: bignums
5255

53-
1. Go to :guilabel:`Admin Tools > Maintenance > Manage Languages Packs`
56+
1. Go to :guilabel:`Admin Tools > Maintenance > Manage Language Packs`
5457

5558
.. include:: /Images/AutomaticScreenshots/Modules/ManageLanguage.rst.txt
5659

@@ -62,108 +65,91 @@ Additional language packs can be installed by administrators in the backend:
6265

6366
.. include:: /Images/AutomaticScreenshots/Modules/ManageLanguagePacksAddLanguageAddSuccess.rst.txt
6467

68+
6569
.. index:: Localization; Local translations
6670
.. _xliff-translating-local:
6771

68-
Local translations
69-
==================
70-
71-
With `t3ll <https://github.com/garfieldius/t3ll>`__ it is possible to translate
72-
XLIFF files locally. t3ll is an open source, cross-platform application and runs
73-
on console under Linux, MacOS and Windows. It opens its editor inside a Google
74-
Chrome or Chromium window.
75-
76-
.. figure:: /Images/ExternalImages/System/t3ll.png
77-
:alt: t3ll screenshot
78-
79-
Translating with t3ll
80-
81-
Just call on a console, for example:
82-
83-
.. tabs::
84-
85-
.. group-tab:: Linux / MacOS
86-
87-
.. code-block:: bash
88-
89-
t3ll path/to/your/extension/Resources/Private/Language/locallang.xlf
72+
Translating XLIFF files locally
73+
===============================
9074

91-
.. group-tab:: Windows
75+
You can translate TYPO3 XLIFF files directly in your development environment
76+
using any XML or translation editor that supports the XLIFF format.
9277

93-
.. code-block:: powershell
78+
TYPO3 v14 and newer support both **XLIFF 1.2** and **XLIFF 2.x**:
9479

95-
t3ll.exe path\to\your\extension\Resources\Private\Language\locallang.xlf
80+
- **XLIFF 2.x:** uses `<unit>` elements and the `<target state="…">` attribute
81+
(`state="reviewed"` / `state="final"` = approved)
82+
- **XLIFF 1.2:** uses `<trans-unit>` and the `approved="yes"` attribute
9683

97-
Translating files locally is useful for extensions which should not be published
98-
or for creating :ref:`custom translations <xliff-translating-custom>`.
84+
Both formats are automatically detected and parsed by TYPO3.
9985

86+
You can use any text or translation editor to modify `.xlf` files locally.
87+
Ensure that your chosen tool supports the XLIFF 2.x format, which is the
88+
default for TYPO3 v14 and later.
10089

10190
.. index:: Localization; Custom translations
10291
.. _xliff-translating-custom:
10392

104-
Custom translations
105-
===================
93+
Overriding or extending translations
94+
====================================
10695

10796
.. versionchanged:: 14.0
10897
`$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']` has been moved
10998
to `$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides'] <https://docs.typo3.org/permalink/t3coreapi:confval-globals-typo3-conf-vars-lang-resourceoverrides>`_.
11099

111100
Option `$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides'] <https://docs.typo3.org/permalink/t3coreapi:confval-globals-typo3-conf-vars-lang-resourceoverrides>`_
112-
allows overriding XLIFF files. This applies not only to translations but
113-
also to default language files.
101+
allows overriding XLIFF files. This applies to both translations and default
102+
(language = English) files.
114103

115-
.. literalinclude:: _ext_localconf.php
104+
.. literalinclude:: _snippets/_ext_localconf.php
116105
:language: php
117106
:caption: EXT:examples/ext_localconf.php
118107

119-
The German language file looks like this:
108+
The German language file could look like this:
120109

121-
.. literalinclude:: _de.locallang_modadministration.xlf
110+
.. literalinclude:: _snippets/_de.locallang_modadministration.xlf
122111
:language: xml
123112
:caption: EXT:examples/Resources/Private/Language/Overrides/de.locallang_modadministration.xlf
124113

114+
TYPO3 loads either XLIFF 1.2 or 2.x — the format is detected automatically.
125115

126-
and the result can be easily seen in the backend:
116+
The result can be seen in the backend:
127117

128118
.. figure:: /Images/ManualScreenshots/Internationalization/InternationalizationLabelOverride.png
129119
:alt: Custom label
130120

131121
Custom translation in the TYPO3 backend
132122

133-
134123
.. attention::
135-
- You do not have to copy the full reference file, but only the labels you
136-
want to translate.
124+
- You only need to include the labels you want to override.
137125
- The path to the file to be overridden must be specified as
138-
:file:`EXT:my_extension/...` and have the extension `xlf`.
126+
:file:`EXT:my_extension/...` and must end with `.xlf`.
139127

140128
.. attention::
141-
The following is a **bug** but must be taken as a constraint for now:
129+
The following is a **known limitation**:
142130

143-
- The files containing the custom labels must be located inside an
144-
extension. Other locations will not be considered.
145-
- The original translation needs to exist in the environment's
131+
- Custom label files must be located inside an extension.
132+
Other locations are ignored.
133+
- The original translation must exist in the environments
146134
:ref:`Environment-labels-path` or next to the base translation file in
147-
extensions, for example in
135+
the extension, for example in
148136
:file:`my_extension/Resources/Private/Language/`.
149137

150138

151139
.. index:: Localization; Custom languages
152140
.. _xliff-translating-languages:
153141

154-
Custom languages
155-
================
142+
Adding custom languages
143+
=======================
156144

157-
TYPO3 :ref:`supports many languages <i18n_languages>` by default. But it is also
158-
possible to add custom languages and create the translations locally using XLIFF
159-
files.
145+
TYPO3 :ref:`supports many languages <i18n_languages>` by default, but you can also
146+
add custom languages and provide your own translations using XLIFF 1.2 or 2.x.
160147

161148
.. rst-class:: bignums-xxl
162149

163150
#. Define the language
164151

165-
As example, we "gsw_CH" (the official code for “Schwiizertüütsch” - that is
166-
"Swiss German") as additional language:
152+
Example: add "gsw_CH" (Swiss German) as an additional language.
167153

168154
.. code-block:: php
169155
:caption: config/system/additional.php | typo3conf/system/additional.php
@@ -174,9 +160,9 @@ files.
174160
175161
#. Add fallback to another language
176162

177-
This new language does not have to be translated entirely. It can be defined
178-
as a fallback to another language, so that only differing labels have to be
179-
translated:
163+
This language does not have to be translated completely.
164+
It can fall back to another language so that only differing labels
165+
need translation.
180166

181167
.. code-block:: php
182168
:caption: config/system/additional.php | typo3conf/system/additional.php
@@ -185,49 +171,43 @@ files.
185171
'gsw_CH' => ['de_AT', 'de'],
186172
];
187173
188-
In this case, we define that "gsw_CH" can fall back on "de_AT" (another
189-
custom translation) and then on "de".
174+
In this example, "gsw_CH" falls back to "de_AT" and then to "de".
190175

191176
#. Add translation files
192177

193-
The translations for system extensions and extensions from :abbr:`TER (TYPO3
194-
Extension Repository)` must be stored in the appropriate labels path
195-
sub-folder (:ref:`Environment-labels-path`), in this case :file:`gsw_CH`.
178+
Translation files for system and extension labels must be stored under the
179+
correct subfolder of the environment’s :ref:`Environment-labels-path`.
180+
The minimum requirement is to translate the language name so it appears
181+
in the user settings.
182+
183+
.. tabs::
184+
185+
.. group-tab:: XLIFF 2.0 (recommended)
186+
187+
.. literalinclude:: _snippets/_gsw_CH.locallang_2.0.xlf
188+
:language: xml
189+
:caption: gsw_CH/setup/Resources/Private/Language/gsw_CH.locallang.xlf
196190

197-
The least you need to do is to translate the label with the name of the language
198-
itself so that it appears in the user settings. In our example, this would be in
199-
the file :file:`gsw_CH/setup/Resources/Private/Language/gsw_CH.locallang.xlf`.
200191

201-
.. code-block:: xml
202-
:caption: gsw_CH/setup/Resources/Private/Language/gsw_CH.locallang.xlf
192+
.. group-tab:: XLIFF 1.2 (legacy)
203193

204-
<?xml version="1.0" encoding="UTF-8"?>
205-
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
206-
<file source-language="en" target-language="gsw_CH" datatype="plaintext" original="EXT:setup/Resources/Private/Language/locallang.xlf">
207-
<body>
208-
<trans-unit id="lang_gsw_CH" approved="yes">
209-
<source>Swiss German</source>
210-
<target>Schwiizertüütsch</target>
211-
</trans-unit>
212-
</body>
213-
</file>
214-
</xliff>
194+
.. literalinclude:: _snippets/_gsw_CH.locallang_1.2.xlf
195+
:language: xml
196+
:caption: gsw_CH/setup/Resources/Private/Language/gsw_CH.locallang.xlf
215197

216-
The custom language is now available in the user settings:
198+
The new language is now available in the backend user settings:
217199

218200
.. include:: /Images/AutomaticScreenshots/Internationalization/CustomLanguage.png.rst.txt
219201

220-
For translations in own extensions you can provide the custom language files
221-
in the :file:`Resources/Private/Language/` folder of the extension, for
222-
example :file:`gsw_CH.locallang_db.xlf`.
202+
For your own extensions, provide the custom language files in the
203+
:file:`Resources/Private/Language/` folder, for example
204+
:file:`gsw_CH.locallang_db.xlf`.
223205

224-
.. note::
225-
Each language will always fall back on the default one (i.e. English) if no
226-
a translation is found. A custom language will fall back on its "parent"
227-
language automatically. Thus, in our second example of "de_AT" (German for
228-
Austria), there would be no need to define a fallback for "de_AT" if it fell
229-
back to "de".
206+
Each language always falls back on the default one (English) if no
207+
translation is found. A custom language automatically falls back on its
208+
defined dependencies. For example, "de_AT" would fall back on "de"
209+
automatically.
230210

231211
.. seealso::
232-
Configure :yaml:`typo3Language` to use custom languages in the frontend,
233-
see :ref:`sitehandling-addinglanguages` for details.
212+
Configure :yaml:`typo3Language` to use custom languages in the frontend.
213+
See :ref:`sitehandling-addinglanguages` for details.

Documentation/ApiOverview/Localization/TranslationServer/Crowdin/Faq.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,42 @@ Crowdin please contact either the maintainer of the extension or the
4646

4747
.. _Localization Team: https://typo3.org/community/teams/localization
4848

49+
. _crowdin-faq-xliff-version:
50+
51+
Why do XLIFF files on Crowdin look different now?
52+
-------------------------------------------------
53+
54+
TYPO3 v14 and newer can use the modern **XLIFF 2.x** format for translation files.
55+
This version introduces a cleaner structure with `<unit>` and `<segment>`
56+
elements and uses the `<target state="…">` attribute instead of the older
57+
`approved="yes"` attribute used in XLIFF 1.2.
58+
59+
Crowdin supports both formats, and TYPO3 automatically detects which version is
60+
used — so you do not need to convert files manually.
61+
62+
.. seealso::
63+
Learn more about XLIFF 2.x in TYPO3:
64+
:ref:`xliff`
65+
66+
.. _crowdin-faq-xliff-convert:
67+
68+
Do I need to convert existing XLIFF 1.2 files to 2.x?
69+
-----------------------------------------------------
70+
71+
Not necessarily.
72+
73+
- As long as your extension **still supports TYPO3 13 LTS**, you **must not**
74+
switch to XLIFF 2.x, because TYPO3 v13 only supports XLIFF 1.2.
75+
- TYPO3 v14 and later can read both XLIFF 1.2 and 2.x files seamlessly.
76+
- For **new extensions** that target TYPO3 14 and above, use **XLIFF 2.x**
77+
from the start.
78+
79+
Before switching, also check that your **translation workflow and tools**
80+
(Crowdin integration, offline editors, or automation scripts) are **compatible
81+
with XLIFF 2.x**. Some older tools might still expect XLIFF 1.2 files.
82+
83+
You can convert existing files manually or by script — see :ref:`xliff` for
84+
examples — but there is no urgent need to migrate if XLIFF 1.2 works for your project.
4985

5086
.. _crowdin-faq-pootle:
5187

0 commit comments

Comments
 (0)