Localization mode (l10n_mode)¶
Path: $GLOBALS[‘TCA’][$table][‘columns’][$field] Required: false Type: string (keyword) Scope: Display / Proc.
Only active if the [‘ctrl’][‘languageField’] property is set.
The main relevance is when a record is localized by an API call in DataHandler that makes a copy of the default language record. You can think of this process as copying all fields from the source record. By default, the given value from the default language record is copied to the localization overlay and the field is editable in the overlay record. This behaviour can be changed:
- Field will not be shown in FormEngine if this record is a localization of the default language. Works basically
like a display condition. Internally, the field value of the default language record is copied over to the
field of the localized record. The DataHandler keeps the values of localized records in sync and actively copies
a changed value from the default language record into the localized overlays if changed.
You can force the field to be displayed as readonly (with default language value)
by setting “l10n_display” to
- The field value from the default language record gets copied when a localization overlay is created, but the content is prefixed with the title of the target language. The field stays editable in the localized record. It only works for field types like “text” and “input”. The text will be prepended and can be configured by the page TSconfig property TCEMAIN.translateToMessage
If this property is not set for a given field, the value of the default language record is copied over to the localized record on creation, the field value is then distinct from the default language record, can be edited at will and will never be overwritten by the DataHandler if the value of the default language record changes.
The following example can be found in the extension styleguide. On translating a record in a new language the content of the
field gets copied to the target language. It get prefixed with
[Translate to <language name>:].
The language mode is defined as follows:
'columns' => [ 'text_2' => [ 'l10n_mode' => 'prefixLangTitle', 'exclude' => 1, 'label' => 'text_2', 'description' => 'cols=20', 'config' => [ 'type' => 'text', 'cols' => 20, ], ], ]
Disable the prefixLangTitle for the header field in tt_content¶
Use the default behaviour instead of
prefixLangTitle: the field will
be copied without a prepended string.
$GLOBALS['TCA']['tt_content']['columns']['header']['l10n_mode'] = ''