Skip to content

Commit ab391ce

Browse files
committed
[TASK] Raise deprecation error on using deprecated labels
Resolves: TYPO3-Documentation/Changelog-To-Doc#1511 Releases: main
1 parent 2287654 commit ab391ce

File tree

1 file changed

+78
-0
lines changed
  • Documentation/ApiOverview/Localization/Labels

1 file changed

+78
-0
lines changed

Documentation/ApiOverview/Localization/Labels/Index.rst

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,3 +335,81 @@ Once you have the correct LanguageService instance, you can resolve labels as fo
335335
): string {
336336
return $languageService->sL($labelReference);
337337
}
338+
339+
.. _label-reference-deprecated:
340+
341+
Replacing deprecated language labels
342+
====================================
343+
344+
.. versiondeprecated:: 14.0
345+
With TYPO3 14 a number of labels and localization files have been deprecated.
346+
347+
The first time after deleting a cache that a label is used an entry such
348+
as the following is written to the deprecation log.
349+
(See `Enabling the deprecation log <https://docs.typo3.org/permalink/t3coreapi:deprecation-enable-errors>`_).
350+
351+
The Extension Scanner does not detect the usage of deprecated localization
352+
labels. Developers must rely on runtime deprecation logs to identify these
353+
occurrences.
354+
355+
Deprecated labels are marked with attribute `x-unused-since="14.0"` in the XLIFF
356+
1.2 localization file and with `subState="deprecated"` in XLIFF 2.0. They will
357+
be removed with the next major TYPO3 version.
358+
359+
It is possible to use these tags to deprecate labels in third party extensions
360+
as well.
361+
362+
To ease migration for Extension developers and projects the development
363+
command :bash:`vendor/bin/typo3 language:domain:search` can be used to search
364+
for specific label contents. :composer:`typo3/cms-lowlevel` needs to be
365+
installed.
366+
367+
For example if you used the now deprecated label reference
368+
`LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime`
369+
370+
You can use the following command:
371+
372+
.. code-block:: bash
373+
374+
vendor/bin/typo3 language:domain:search --search starttime
375+
376+
core.db.general file EXT:core/Resources/Private/Language/db/general.xlf
377+
=======================================================================
378+
379+
+-----------------+--------------------+
380+
| Label Reference | Label Content (en) |
381+
+-----------------+--------------------+
382+
| starttime | Publish Date |
383+
+-----------------+--------------------+
384+
385+
386+
To search for any label reference key or content containing "starttime". If
387+
the label content fits your purpose you can switch your label reference to the
388+
new location:
389+
390+
.. code-block:: diff
391+
:caption: Fluid Template (diff)
392+
393+
- <f:translate id="LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime" />
394+
+ <f:translate id="starttime" domain="core.db.general" />
395+
396+
.. code-block:: diff
397+
:caption: TCA definition (diff)
398+
399+
'my_special_starttime' => [
400+
- 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
401+
+ 'label' => 'core.db.general:starttime',
402+
'config' => [
403+
'type' => 'datetime',
404+
'default' => 0,
405+
],
406+
],
407+
408+
.. code-block:: diff
409+
:caption: PHP controller or service (diff)
410+
411+
- $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime')
412+
+ $languageService->sL('core.db.general:starttime')
413+
414+
If you can find no suitable label for your use case consider moving the label
415+
to your own extensions XLIFF localization files.

0 commit comments

Comments
 (0)