Skip to content

Commit 0be8f49

Browse files
authored
[!!!][FEATURE] Use symfony/translation for translatable labels (#6047)
* [!!!][FEATURE] Use symfony/translation for translatable labels Resolves: TYPO3-Documentation/Changelog-To-Doc#1317 Releases: main * [TASK] Migrate scheduler database to new storage format I created a new Upgrade section where important upgrade information such as this can be collected Resolves: TYPO3-Documentation/Changelog-To-Doc#1242 Releases: main
1 parent db5cb72 commit 0be8f49

File tree

13 files changed

+247
-60
lines changed

13 files changed

+247
-60
lines changed

Documentation/Administration/Upgrade/Major/Index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Major upgrade
3535
:hidden:
3636
:titlesonly:
3737

38+
Version14
3839
PreupgradeTasks/Index
3940
UpgradeCore
4041
PostupgradeTasks/Index
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
:navigation-title: TYPO3 14
2+
3+
.. include:: /Includes.rst.txt
4+
.. _upgrade-14:
5+
6+
=====================================
7+
TYPO3 14: Upgrading the major version
8+
=====================================
9+
10+
.. warning::
11+
12+
This list is still work in progress. If you have additional tips or found
13+
a pitfall, use the "Report an issue" button to suggest your solution or
14+
the "Edit on GitHub" button to provide a pull request directly.
15+
16+
.. contents:: Table of contents
17+
18+
.. _upgrade-wizards-14:
19+
20+
Upgrade Wizards for TYPO3 14
21+
============================
22+
23+
.. _upgrade-wizards-14-scheduler:
24+
25+
Migration of scheduler tasks to the new format
26+
----------------------------------------------
27+
28+
.. seealso::
29+
* `Important: #106532 - Changed database storage format for Scheduler Tasks <https://docs.typo3.org/permalink/changelog:important-106532-1744207039>`_
30+
31+
The following upgrade wizard has to be run if the system extension
32+
:composer:`typo3/cms-scheduler` is installed:
33+
34+
**Migrate the contents of the tx_scheduler_task database table into a more structured form.**
35+
36+
The Scheduler task format has changed in TYPO3 v14. You must run the upgrade
37+
wizard to migrate existing tasks.
38+
39+
* If the wizard stays visible after execution, some tasks could not be
40+
migrated. Check tx_scheduler_task for entries with an empty tasktype and
41+
recreate them manually.
42+
* Run this step **only in TYPO3 v14**. It may not work in later versions.

Documentation/ApiOverview/Events/Events/Core/Country/BeforeCountriesEvaluatedEvent.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ provider class itself and ViewHelpers like the
2222
the country names.
2323

2424
If additional countries are added, add translations to `countries.xlf`
25-
via :ref:`locallangXMLOverride <t3coreapi:xliff-translating-custom>`.
25+
via :ref:`$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides'] <t3coreapi:xliff-translating-custom>`.
2626

2727
.. contents:: Table of contents
2828

@@ -39,10 +39,15 @@ code 'XX' and alpha 3 code 'XXX'.
3939

4040
.. include:: /_includes/EventsAttributeAdded.rst.txt
4141

42+
43+
.. versionchanged:: 14.0
44+
`$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']` has been moved
45+
to `$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides'] <https://docs.typo3.org/permalink/t3coreapi:confval-globals-typo3-conf-vars-lang-resourceoverrides>`_.
46+
4247
As the localized names for the countries are defined in file
4348
:file:`EXT:core/Resources/Private/Language/Iso/countries.xlf`, this language
4449
file needs to be extended via
45-
:ref:`locallangXMLOverride <t3coreapi:xliff-translating-custom>`:
50+
:ref:`$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides'] <t3coreapi:xliff-translating-custom>`:
4651

4752
.. literalinclude:: _BeforeCountriesEvaluatedEvent/_ext_localconf.php
4853
:caption: EXT:my_extension/ext_localconf.php
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22

3-
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']
3+
$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides']
44
['EXT:core/Resources/Private/Language/Iso/countries.xlf'][]
55
= 'EXT:my_extension/Resources/Private/Language/countries.xlf';
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.. include:: /Includes.rst.txt
2+
.. _LanguageService-loaders:
3+
4+
===================
5+
Translation loaders
6+
===================
7+
8+
.. versionchanged:: 14.0
9+
The TYPO3 localization system has been migrated to use Symfony Translation
10+
components.
11+
12+
Custom language parsers, registered via
13+
`$GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['parser']['xlf']` are not
14+
supported anymore.
15+
16+
In order to load translation files TYPO3 uses class
17+
:php:`\TYPO3\CMS\Core\Localization\Loader\XliffLoader` for XLIFF file processing.
18+
19+
TYPO3 overrides the default XLIFF loader provided by Symfony to implement
20+
special functionality like
21+
`$GLOBALS['TYPO3_CONF_VARS']['LANG']['requireApprovedLocalizations'] <https://docs.typo3.org/permalink/t3coreapi:confval-globals-typo3-conf-vars-sys-lang-requireapprovedlocalizations>`_.
22+
23+
.. _LanguageService-loaders-custom:
24+
25+
Example: A custom json translation file loader
26+
==============================================
27+
28+
.. versionadded:: 14.0
29+
30+
Extension developers can now implement custom translation loaders by
31+
implementing Symfony's translation loader interfaces:
32+
33+
.. literalinclude:: _codesnippets/_JsonFileLoader.php
34+
:caption: EXT:my_extension/Classes/JsonFileLoader.php
35+
36+
Register custom loaders via configuration:
37+
38+
.. code-block:: php
39+
:caption: EXT:my_extension/ext_localconf.php
40+
41+
$GLOBALS['TYPO3_CONF_VARS']['LANG']['loader']['json'] = \MyExtension\Translation\JsonFileLoader::class;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace MyVendor\MyExtension\LanguageLoader;
6+
7+
use Symfony\Component\Translation\Loader\LoaderInterface;
8+
use Symfony\Component\Translation\MessageCatalogue;
9+
10+
class JsonFileLoader implements LoaderInterface
11+
{
12+
public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue
13+
{
14+
$catalogue = new MessageCatalogue($locale);
15+
if (!is_string($resource) || !file_exists($resource)) {
16+
throw new \InvalidArgumentException(sprintf('Resource "%s" is not a valid file.', $resource), 1695225932);
17+
}
18+
$data = json_decode(file_get_contents($resource), true, 512, JSON_THROW_ON_ERROR);
19+
foreach ($data as $key => $translation) {
20+
$catalogue->set((string)$key, (string)$translation, $domain);
21+
}
22+
return $catalogue;
23+
}
24+
}

Documentation/ApiOverview/Localization/ManagingTranslations.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,13 @@ or for creating :ref:`custom translations <xliff-translating-custom>`.
104104
Custom translations
105105
===================
106106

107-
:php:`$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']` allows to
108-
override XLIFF files. Actually, this is not just about translations. Default
109-
language files can also be overridden. The syntax is as follows:
107+
.. versionchanged:: 14.0
108+
`$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']` has been moved
109+
to `$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides'] <https://docs.typo3.org/permalink/t3coreapi:confval-globals-typo3-conf-vars-lang-resourceoverrides>`_.
110+
111+
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.
110114

111115
.. literalinclude:: _ext_localconf.php
112116
:language: php

Documentation/ApiOverview/Localization/XliffFormat.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ language is placed in an additional file.
9393

9494
By default, only translations with no :xml:`approved` attribute or with
9595
the attribute set to :xml:`yes` are taken into account when parsing XLF
96-
files. Set the option :ref:`requireApprovedLocalizations
97-
<typo3ConfVars_sys_lang_requireApprovedLocalizations>` to :php:`false`
98-
to use translations with the :xml:`approved` attribute set to :xml:`no`.
96+
files. Set the option
97+
`$GLOBALS['TYPO3_CONF_VARS']['LANG']['requireApprovedLocalizations'] <https://docs.typo3.org/permalink/t3coreapi:confval-globals-typo3-conf-vars-sys-lang-requireapprovedlocalizations>`_
98+
to :php:`false` to use translations with the :xml:`approved` attribute set
99+
to :xml:`no`.
99100

100101
.. index:: ! Path; EXT:{extkey}/Resources/Private/Language
101102
.. _xliff-files:

Documentation/ApiOverview/Localization/_ext_localconf.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
defined('TYPO3') or die();
66
// Override a file in the default language
77

8-
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']
8+
$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides']
99
['EXT:frontend/Resources/Private/Language/locallang_tca.xlf'][]
1010
= 'EXT:examples/Resources/Private/Language/custom.xlf';
1111
// Override a German ("de") translation
12-
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['de']
12+
$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides']['de']
1313
['EXT:news/Resources/Private/Language/locallang_modadministration.xlf'][]
1414
= 'EXT:examples/Resources/Private/Language/Overrides/de.locallang_modadministration.xlf';
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
.. include:: /Includes.rst.txt
2+
3+
.. _typo3ConfVars_sys_lang:
4+
.. _typo3ConfVars_lang:
5+
6+
=============================
7+
LANG - Language configuration
8+
=============================
9+
10+
.. confval-menu::
11+
:name: globals-typo3-conf-vars-lang
12+
:display: tree
13+
:type:
14+
15+
.. _typo3ConfVars_sys_lang_requireApprovedLocalizations:
16+
17+
.. confval:: requireApprovedLocalizations
18+
:name: globals-typo3-conf-vars-sys-lang-requireApprovedLocalizations
19+
:Path: $GLOBALS['TYPO3_CONF_VARS']['LANG']['requireApprovedLocalizations']
20+
:type: bool
21+
:Default: true
22+
23+
.. versionchanged:: 14.0
24+
This option has been moved from `$GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['requireApprovedLocalizations']`.
25+
26+
The attribute :xml:`approved` of the :ref:`XLIFF <xliff>` standard is
27+
respected by TYPO3 since version 12.0 when parsing XLF files. This attribute
28+
can either have the value :xml:`yes` or :xml:`no` and indicates whether the
29+
translation is final or not.
30+
31+
.. code-block:: xml
32+
:caption: EXT:my_extension/Resources/Private/Language/locallang.xml
33+
34+
<trans-unit id="label2" approved="yes">
35+
<source>This is label #2</source>
36+
<target>Ceci est le libellé no. 2</target>
37+
</trans-unit>
38+
39+
This setting can be used to control the behavior:
40+
41+
:php:`true`
42+
Only translations with the attribute :xml:`approved` set to :xml:`yes`
43+
will be used. Any non-approved translation (value is set to :xml:`no`)
44+
will be ignored. If the attribute :xml:`approved` is omitted, the
45+
translation is still taken into account.
46+
47+
:php:`false`
48+
All translations are used.
49+
50+
.. confval:: loader
51+
:name: globals-typo3-conf-vars-lang-loader
52+
:Path: $GLOBALS['TYPO3_CONF_VARS']['LANG']['loader']
53+
:type: array
54+
55+
.. versionchanged:: 14.0
56+
This option is a predecessor of `$GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['parser']`.
57+
58+
Configures custom translation loaders.
59+
60+
.. confval:: format
61+
:name: globals-typo3-conf-vars-lang-format
62+
:Path: $GLOBALS['TYPO3_CONF_VARS']['LANG']['format']
63+
:type: bool
64+
:Default: true
65+
66+
.. versionchanged:: 14.0
67+
This option has been moved from `$GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']`.
68+
69+
.. confval:: availableLocales
70+
:name: globals-typo3-conf-vars-lang-availableLocales
71+
:Path: $GLOBALS['TYPO3_CONF_VARS']['LANG']['availableLocales']
72+
:type: array
73+
:Default: `['default']`
74+
75+
.. versionchanged:: 14.0
76+
This option has been moved from `$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lang']['availableLanguages']`.
77+
78+
.. confval:: resourceOverrides
79+
:name: globals-typo3-conf-vars-lang-resourceOverrides
80+
:Path: $GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides']
81+
:type: array
82+
:Default: `[]`
83+
84+
.. versionchanged:: 14.0
85+
This option has been moved from `$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']`.
86+
87+
Allows overriding XLIFF files. This applies not only to translations but
88+
also to default language files.
89+
90+
See also: `Custom translations <https://docs.typo3.org/permalink/t3coreapi:xliff-translating-custom>`_
91+
92+
The syntax is as follows:
93+
94+
.. code-block:: php
95+
96+
$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides']
97+
['EXT:frontend/Resources/Private/Language/locallang_tca.xlf'][]
98+
= 'EXT:examples/Resources/Private/Language/custom.xlf';
99+
// Override a German ("de") translation
100+
$GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides']['de']
101+
['EXT:news/Resources/Private/Language/locallang_modadministration.xlf'][]
102+
= 'EXT:examples/Resources/Private/Language/Overrides/de.locallang_modadministration.xlf';

0 commit comments

Comments
 (0)