The Language File Editor

What is the "Language File Editor"?

The "Language File Editor" is a TYPO3 extension that supports developers, integrators and editors in the editing, creation and maintenance of language constants. This ranges from the outdated PHP format to the XML variant and the modern XLF solution.

This extension offers various functions for editing language files. Not only professional users are supported, but also "normal users". The functions that this enhancement contains are listed below:

  • The formats: PHP, XML, XLF
  • Different input types (simple text input, rich text)
  • Conversion between the different formats
  • Splitting and merging of language files
  • Easy editing of individual constants and complete languages
  • Flexible search and view of constants and values
  • Handling of meta information (such as the last processing date)
  • Backups with difference display and their recovery

README der Extension

EXT:lfeditor

License: GNU GPL, Version 2

Repository: https://gitlab.sgalinski.de/typo3/lfeditor

Please report bugs here: https://gitlab.sgalinski.de/typo3/lfeditor

About

The lfeditor is a GUI for adding, editing and deleting translations in .xlf, .xml and .php files.

XML and PHP files can be converted to .xlf files.

The editor can be found in the user tool section of the TYPO3 backend (click on your user in the top panel and select LFEditor).

Configuration

Extension Settings

In the extension manager, you can configure the following settings of the lfeditor extension:

View languages

List of languages which will be available in the extension (comma separated country codes e.g. en, de, fi).

If this setting is empty, all languages will be used (Warning: very long list!). Default language is always included.


Default language

If en is not the default language in TYPO3 backend, the default language must be defined here. If this field is empty, English is used as default.


Ignore extensions

Regular expression which can be used to exclude extensions by their extension key.


Change XLF date

If set to TRUE, LFEditor will change the date in the files on each change.

Extension Settings

There is an additional option in the Access Rights tab on the very bottom, when editing a non-admin backend user. You can now select the The user can save localization changes directly to extensions?.

Backend users who don't have this check box selected, will be in override mode by default, and they can't switch to another mode.

Usage

The Menu

Main navigation through LFEditor is done by selecting one of the options of drop down menu on top-left part of the screen.

General

This option displays general information about all the languages.

Displayed languages should be configured in the configuration section of LFEditor, because the default behavior of LFEditor for administrators is to display all existing translation languages of TYPO3. While non-admin users see only languages which they have permissions for.

Beside the language shortcut, there is the state and origin of the related language file. Clicking any language shortcut redirects to the Edit File page for this language.

The column state shows the state of translation and contains the number of translated, unknown and untranslated language constants. Unknown constants are the ones which exist in the language and don’t exist in default language.

At the bottom of the page, there are options for converting and splitting language files. Those options are not displayed in override mode, and it is not possible to merge your files. Splitting of language files increases the performance of backend and frontend. There is also a field set that allows editing of the meta information in language files.


Edit File

This option allows editing of all constants in a language file and a selected language. Users can choose between translated, untranslated, unknown or all constants.

This whole dialog is handled by a session. This means that a user can translate a whole page and doesn't need to save the changes before clicking on 'next' button to get the next page with language constants.


Edit Constant

This option serves for translating a single constant in several languages. Available languages depend on the user language privileges and on the configured "view languages".


Add Constant

This option serves for adding new constants to language files. The user needs to enter a new name and translations for chosen languages can be entered right away.


Delete Constant

This option allows the user to delete a selected constant. The constant will be deleted from all languages.


Rename Constant

This option serves for renaming the key of an existing language constant. The constant to rename is chosen from a select list, and then the new name is entered in the text field.


Search Constants

This option allows the user to search for constants in all language files.

  • Find constants which match the search string within a key or value (translation).
  • The matching can be case-sensitive or insensitive
  • Supports regular expressions
  • Looks only among a subset of languages which is defined in the lfeditor extension configuration

Clicking on a constant key of any search result, redirects to the Edit Constant page.


View Tree

This option serves for a better overview and easier access to constants. It displays all constants of a language file arranged in a tree.

Constants are displayed as leaves of the tree, and they are colored in three colors which indicate the translation state of each constant for a selected language (language from first select box).

Constants are compared to a language from the second select box, resulting in three states:

  • green - normal constant (translated in both languages)
  • red - untranslated constant (translated only in second language)
  • blue - unknown constant (translated only in first language)

Clicking on tree leaf (last segment of constant key) redirects to the Edit Constant page.


Manage Backups

The backup option displays all backups of the selected extension. It is possible to recover every backup, delete them or just have a look at the differences. User can revert splitting and merging of files too.

Conversions of the file format are not revertible.

If language file was converted to another format, there will be a red warning in the status of the backup table entry and that backup can only be deleted.

All changes since the backup are visible through the differences' functionality. Green color means that the constant was added and red that it was deleted since the backup was made.

Editing modes

There are three editing modes:

  • Extension mode
  • l10n mode
  • Override mode

They can be chosen from the rightmost select menu on top of the screen. The select menu is visible only for administrators.

If the user is not an admin, Override mode is chosen by default. For administrators, the default is the Extension mode.

Extension mode

This mode is useful for extension developers, because in this mode the lfeditor edits the extension files directly. Even if copies of extension files exist in l10n folder or extension files are overridden, lfeditor will still edit the extension files only.


l10n mode

This mode is similar to extension mode, with the only difference being that the l10n directory has higher priority than the extension directory. This means that if there is a copy of the language file in l10n folder (e.g. de.locallang), that copy will be edited instead of the original extension file. If there is no corresponding file in l10n folder the original file will be edited.

Here are some of the characteristics of l10n mode:

  • Files can't be moved to the l10n folder. They can be edited if they already exist in l10n folder
  • Merging/splitting is not allowed in l10n mode
  • Renaming of a constant will rename it in the main language file (e.g. ext/.../locallang) and in all subfiles in the l10n (e.g. l10n/.../de.locallang) and ext folder
  • Deleting and adding files work similar to renaming

Override mode

The purpose of this mode is making translations unaffected by changes in an extension (e.g., when an extension updates, the translations will be preserved). This mode is useful for translators and is the only mode available for non-admin users.

  • If a user makes any changes in a language file, only the changed constants (or metadata) will be saved in the corresponding language file in typo3confLFEditorOverrideFiles
  • When reading language file, LFEditor is first reading constants from files in override folder, then it reads rest of constants from l10n folder (if there is corresponding file in l10n folder), and then reads from ext folder (if there was no file in l10n folder).
Note for switch to v4 of v4 of typo3/cms-composer-installers:

If you do switch to new composer installer, you will have to rename your Overridesfolder to use "-" instead of "_", since the naming scheme is different.

Installation / Integration

Open the TYPO3 backend and click on "Extension Manager" in the "Admin Tools" section on the left side.

Using the function "Add Extensions" you can click "Update now" to update your package list. Then enter "LFEditor" in the search and click on the button under "Actions" to add "LFEditor".

Using the Language File Editor

Under "User tools" you will now find the "LFEditor". In the upper left corner you can choose whether you want to edit a file, add or delete a constant (and so on).

Edit language file

In this example, the file "locallang_csh.xml" is selected from the extension "realurl", with the language "de" (German). Under the selection "select type of constants" you can select all, translated, not translated and unknown. Unknown language files are only displayed in the original language.

The "LFEditor" will then output the files as shown in Figure 3. In the upper field the reference language, in the lower field the original language.

Adding constants

As the name suggests, you can add constants under this menu item. You can choose a constant name and complete the translations.

Edit constants

If you select "Edit constants", you will see an extended version of Figure 3, normally the 53 language fields are displayed, which then contain the respective translation of the "Folder tree" (if available). You can change the number of languages displayed via the "View Languages" configuration (see Figure 9). If you see that the German translation is missing, you can simply enter it and save it at the bottom of the page.

Deleting constants

Under the menu item "Delete constant" you can delete constants from language files. Select extension, language file and constant, possibly set and delete check marks.

Renaming constants

Constants can be renamed quickly. After the usual selection, simply insert your desired name in "New constant name" and click on "Rename".

Searching for constants

After you have selected the appropriate extension and language file, enter either the full name or just a part of it. As you can see, there are two results for the search term "folder". For example, if you now click on "folderTree", you will be directed to "Edit constant" of the constant "folderTree".

Tree View

In the tree view you can see all constants that you can also call up in "Edit constants". In the tree view, however, you can see in advance whether a translation is available for the constant.

Green: Translation available
Red: Translation not available
Blue: Unknown constant

If you click on a constant in the tree view, you will be forwarded to "Edit Constant".

Manage backups

"Manage backups" shows all backups of an extension. You can delete, restore and compare the backups with the original. You can undo separations and merges of files. However, the conversion of file formats cannot be undone.

Configure extension

You can easily get to the configuration by searching for the "Language File Editor" in the "Extension Manager" under the menu item "Manage Extensions" and clicking on the cogwheel (Figure 10). You can read about the configuration options of the "LFEditor" in the following text.

Files and Folders

backup directory [basic.pathBackup]
Renames the path for the backup directory
For example: typo3conf/LFEditor/Backup/

xll files directory [basic.pathXLLFiles]
Renames the path of the xll file directory
For example: typo3conf/LFEditor/XLL/

backup meta information file [basic.metaFile]
The path to the backup meta information file
For example: typo3conf/LFEditor/Backup/Meta.xml

Activate functions

enable backup [basic.execBackup]
You must check this box if you want to use backup management
(which is highly recommended)

Other options

view system extensions [basic.viewSysExt]
Activate this option to display the system extensions in the "Selection of extensions" (see Figures 2-9)

view global extensions [basic.viewGlobalExt]
Activate this option to display global extensions in the "Selection of extensions" (see Figures 2-9)

view local extensions [basic.viewLocalExt]
Activate this option to display local extensions in the "Selection of extensions" (see Figures 2-9)

view languages [basic.viewLanguages]
Allows you to set the languages displayed under "Edit constant" and "Add constant". Please abbreviate the desired languages e.g. "de" for German. Default is always displayed.

view loaded and unloaded extensions [basic.viewStateExt]
Enter 0 to display all extensions, 1 for installed extensions and 2 to display non-installed extensions

ignore extensions [basic.extIgnore]
You can change the regular expression to restrict the enhancement list

Set to true if you want to hide the tree branches at start of the tree page. [basic.treeHide]
Check this box to hide the "branches" of the "page tree".

constants per site in language file edit mode [basic.numSiteConsts]
Defines the number of constants per page displayed in the language file editing mode

amount of rows in text area [basic.numTextAreaRows]
Enter the number of lines you want in a normal text field. This function is not supported by tinyMCE.

maximal amount of backup files [basic.anzBackup]
Set this value to 0 to keep all backup files, otherwise all files up to the given value will be deleted.

[basic.changeXlfDate]
Check this box if you want the editor to change the date in XLF files.

Video Instructions

If this manual is too boring for you, you can also watch it as a video ;-)

Vorstellung: Der Language File Editor