LFEditor: Override mode

LFEditor: Override mode

Damjan Komlenac 05. März 2015 Releases

0 Kommentare // Lesezeit: 3 min.

TYPO3 allows language file overriding. Users can override extension files or even language files of the TYPO3 environment, meaning that user can change labels of TYPO3 backend in this way. Overriding extension files is useful for most users, because in this way the files don’t need to be kept in the extension directory. Thus, user-made translations will stay preserved after extension updates.

How to override a language file in TYPO3?

The user must create an override language file and add the following line in AdditionalConfiguration.php for each localization file he wishes to override:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][path_to_lang_file_to_be_overriden][] = path_to_override_file;

This line needs to be added only for main language files (e.g. locallang), and not for files which contain translations (e.g. de.locallang).

But, if LFEditor is used, there is no need to worry about creation of override language files, nor about adding configuration lines in AdditionalConfiguration.php. The LFEditor does that automatically for you.

Overriding language files with LFEditor

If TPO3 backend user is an administrator, he needs to select the override mode from rightmost menu on the top of the screen (frame), like in the following picture. The override mode is default editing mode for non-admin users and they can’t change it.
This picture illustrates changing of TYPO3 backend label value by overriding it. As it can be concluded from the picture, overriding language files with LFEditor is simple and interface is same like in other editing modes. While in override mode, users can edit, add, delete or rename language constants. Also he can edit meta data, use the tree view and search for constants. Only functions that are forbidden in override mode are file format conversions and file transformations (split/merge).

It is important to point out that none of the changes will be applied to original localization files, and all the changes will be saved inside the override file. When LFEditor reads the language file in override mode, first it reads constants from override file, and then reads rest of the constants from the original file (or from the l10n directory if files exist there, because this folder has priority over the extension directory).

How is overriding done by LFEditor?

When changes are made to a localization file (upon hitting ‘save’ button), LFEditor makes override file and adds a corresponding line to the AdditionalConfiguration.php, for example:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:lang/locallang_mod_web_perm.xlf'][0] = 'typo3conf/LFEditor/OverrideFiles/lang/locallang_mod_web_perm.xml';

All override files are kept in a special folder: ‘typo3conf\LFEditor\OverrideFiles’, so they are resistant to extension updates. Within that location, for each override file, directory structure is made, same as it is in it’s belonging extension. The directory structure is illustrated in the picture.

You can see the source code on our GitLab. You can also track the progress, and feel free to report bugs on Forge. Detailed description of all LFEditor features can be found in our documentation . We hope that this feature will be useful to you. :-)


Keine Kommentare.
    Dateien hier ablegen