Language fields 

See also the Frontend Localization Guide.

All columns mentioned below get auto-created in the TCA and added to the database automatically. It is not recommended to define them in the TCA overrides or ext_tables.sql. Doing so with incompatible settings can lead to problems later on.

Language fields in detail 

sys_language_uid

This field gets defined in ctrl->languageField. If this field is defined a record in this table can be translated into another language.

The language of a conference

The language of a conference

l10n_parent

This field gets defined in ctrl->transOrigPointerField.

If this value is found being set together with languageField then FormEngine will show the default translation value under the fields in the main form.

The contact email of a translated conference with the value of the default language

The contact email of a translated conference with the value of the default language

l10n_source

This field gets defined in ctrl->translationSource.

This field contains the uid of the record the translation was created from. For example if your default language is English and you already translated a record into German you can base the Suisse-German translation on the German record. In this case l10n_parent would contain the uid of the English record while l10n_source contains the uid of the German record.

l10n_diffsource

This field gets defined in ctrl->transOrigPointerField.

This information is used later on to compare the current values of the default record with those stored in this field. If they differ, there will be a display in the form of the difference visually:

Example: Enable table for localization and translation: 

EXT:my_extension/Configuration/TCA/tx_myextension_conference.php
<?php

return [
  'ctrl' => [
    'title' => 'my_extension.db:conference',
    'label' => 'title',
    'descriptionColumn' => 'internal_notes',
    'default_sortby' => 'conference_date DESC',
    'tstamp' => 'tstamp',
    'crdate' => 'crdate',
    'delete' => 'deleted',
    'editlock' => 'editlock',
    'enablecolumns' => [
      'disabled' => 'hidden',
      'starttime' => 'starttime',
      'endtime' => 'endtime',
      'fe_group' => 'fe_group',
    ],
    'languageField' => 'sys_language_uid',
    'transOrigPointerField' => 'l10n_parent',
    'transOrigDiffSourceField' => 'l10n_diffsource',
    'translationSource' => 'l10n_source',
    'versioningWS' => true,
    'origUid' => 't3_origuid',
    'iconfile' => 'EXT:my_extension/Resources/Public/Icons/Conference.svg',
    'security' => [
      'ignorePageTypeRestriction' => true,
    ],
  ],
  'columns' => [
    'title' => [
      'label' => 'my_extension.db:conference.title',
      'config' => [
        'type' => 'input',
        'required' => true,
        'max' => 255,
        'eval' => 'trim',
      ],
    ],
    'conference_date' => [
      'label' => 'my_extension.db:conference.conference_date',
      'config' => [
        'type' => 'datetime',
        'format' => 'date',
        'required' => true,
      ],
    ],
    'internal_notes' => [
      'label' => 'my_extension.db:conference.internal_notes',
      'config' => [
        'type' => 'text',
        'rows' => 3,
      ],
    ],
  ],
  // The fields of the other tabs are added in Configuration/TCA/Overrides/
  'types' => [
    '0' => [
      'showitem' => '
        title, conference_date,
        --div--;my_extension.db:tab.program,
        --div--;my_extension.db:tab.details,
        --div--;core.form.tabs:categories,
        --div--;core.form.tabs:access,
          hidden, --palette--;;access, fe_group, editlock,
        --div--;core.form.tabs:language,
          --palette--;;language,
        --div--;my_extension.db:tab.comments,
        --div--;core.form.tabs:notes,
          internal_notes,
      ',
    ],
  ],
  'palettes' => [
    'access' => [
      'label' => 'core.form.palettes:access',
      // The labels of the fields tell the editors what the dates are for
      'showitem' => '
        starttime;my_extension.db:conference.starttime,
        endtime;my_extension.db:conference.endtime,
      ',
    ],
    'language' => [
      'showitem' => 'sys_language_uid, l10n_parent',
    ],
  ],
];
Copied!