is there a way to substitute/override the default de.locallang.xlf of the extension via Typoscript? I want to change the text of mindshape_cookie_hint in a way that will survive an update.
3 Answers
If it is a plugin you can override translations in TypoScript via
_LOCAL_LANG
which is also whatmindshape_cookie_hint
suggests in its docs, for example:plugin.tx_myext_pi1._LOCAL_LANG.de.list_mode_1 = Der erste Modus
This requires you to manage your translation strings in TypoScript though which is far from ideal.
A better and more general solution is registering custom translations via
locallangXMLOverride
. This allows you to manage these translations just like everywhere else.From the documentation:
ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:cms/locallang_tca.xlf'][] = 'EXT:examples/Resources/Private/Language/custom.xlf'; $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] ['de']['EXT:news/Resources/Private/Language/locallang_modadministration.xlf'][] = 'EXT:examples/Resources/Private/Language/Overrides/de.locallang_modadministration.xlf';
The first line shows how to override a file in the default language, the second how to override a German ("de") translation. The German language file looks like this:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> <file source-language="en" datatype="plaintext" original="messages" date="2013-03-09T18:44:59Z" product-name="examples"> <header/> <body> <trans-unit id="pages.title_formlabel" xml:space="preserve"> <source>Most important tile</source> <target>Wichtigster Titel</target> </trans-unit> </body> </file> </xliff>

- 2,832
- 1
- 27
- 49

- 5,905
- 13
- 30
-
2Also links of TYPO3 servers change, it would be great if you could add the essential information directly in your answer. Policy of Stack Overflow is to avoid link-only answers. Thanks! – David Apr 14 '19 at 08:56
-
Correct me if I'm wrong, but wouldn't locallangXMLOverride solution break new or edited label keys after a regular extension update? – Deivid As May 01 '23 at 09:13
-
**EDIT:** I just tested my pressumption and find out it works even if new labels are added. TYPO3 does merge and override labels. This should be the cleanest way to override labels of 3rd party extensions. – Deivid As May 01 '23 at 09:23
You are looking for this https://wiki.typo3.org/TypoScript_language_additions,_override
As written by Ghanshyam Bhava in his answer, you can just take a look at
the locallang.xlf
file in the plugin folder in the file system to have an overview of the keys the extension uses and then write in your TypoScript template:
plugin.tx_exampleplugin_pi1._LOCAL_LANG.it {
key1 = value1
key2 = value2
...
}
In a general way, correct me if I am wrong, I think that you have modified the original .xlf file of the plugin; this procedure is not recommended for the reason you are facing: an update would delete your changes.
A good way to deal with this problem could be for example using the extension EXT:lfeditor (https://extensions.typo3.org/extension/lfeditor/); read carefully its manual.
Another source (official documentation): https://docs.typo3.org/typo3cms/CoreApiReference/latest/ApiOverview/Internationalization/ManagingTranslations.html?highlight=locallangxmloverride#custom-translations
I'll take an excerpt from that page:
The
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']
allows to override both locallang-XML and XLIFF files. Actually this is not just about translations. Default language files can also be overridden. In the case of XLIFF files, the syntax is as follows (to be placed in an extension'sext_localconf.php
file):$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:cms/locallang_tca.xlf'][] = 'EXT:examples/Resources/Private/Language/custom.xlf'; $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['de']['EXT:news/Resources/Private/Language/locallang_modadministration.xlf'][] = 'EXT:examples/Resources/Private/Language/Overrides/de.locallang_modadministration.xlf';
The first line shows how to override a file in the default language, the second how to override a German ("de") translation. The German language file looks like this:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <xliff version="1.0"> <file source-language="en" datatype="plaintext" original="messages" date="2013-03-09T18:44:59Z" product-name="examples"> <header/> <body> <trans-unit id="pages.title_formlabel" xml:space="preserve"> <source>Most important tile</source> <target>Wichtigster Titel</target> </trans-unit> </body> </file> </xliff>

- 1
- 1

- 2,128
- 7
- 17
-
Sorry Ricardo, nerving a bit: Also links of TYPO3 servers change, it would be great if you could add the essential information directly in your answer. Policy of Stack Overflow is to avoid link-only answers. Thanks! – David Apr 14 '19 at 08:56
With below typoscript you can overwrite individual translations for TYPO3 Extension:
plugin.tx_myPlugin_pi1._LOCAL_LANG.de.key = value;
plugin.tx_myPlugin_pi1._LOCAL_LANG.en.key = value;
Generally common for every extension. Hope this will help you!
Greetings!

- 2,217
- 15
- 30