Feature: #78169 - Introduce "Translation Source" field for tt_content¶
See forge#78169
Description¶
The new database field l10n_source
for tt_content table has been introduced together with a new TCA ctrl configuration translationSource
.
The translationSource
field contains a uid of the record used as a translation source, no matter whether the record was translated in the free or connected mode.
The new TCA configuration translationSource
contains column name, similar to the transOrigPointerField
.
e.g.
$GLOBALS['TCA']['tt_content']['ctrl']['translationSource'] = 'l10n_source';
Copied!
The new field solves few issues:
- There was no way to detect whether a record was translated using connected mode or free mode.
If a record has value > 0 in the
transOrigPointerField
(e.g.l10n_parent
) field, it means it was translated using "connected mode". If thetransOrigPointerField
is 0 but thetranslationSource
field is > 0 it means it was translated using "free mode". If both are 0, it means the record was not translated but created manually. - TYPO3 allows to use a record in non-default language as a translation source. In this case the information about the translation source was lost.
Now, the
translationSource
field always contains a uid of the record used as a translation source. - In some places
origUid
(e.g.t3_origuid
) fields were misused as a translation source. Now these places can be refactored to use thetranslationSource
field.
Difference between translationSource
and other existing fields¶
transOrigPointerField
(e.g.l10n_parent
) - "translation parent" - this field contains uid of the record in the default language representing the same content. ThetranslationSource
field can contain a uid of the record in non-default language.origUid
(e.g.t3_origuid
) - "copy source" - this field contains uid of the record, current record was copied from. It might be equal totranslationSource
as localization is a copy internally, but often it is different.
See following test scenarios to see how data is handled in details.
\TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Modify\ActionTest::localizeContent
\TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Modify\ActionTest::localizeContentFromNonDefaultLanguage
\TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Modify\ActionTest::copyContentToLanguage
\TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Modify\ActionTest::copyPage
\TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Modify\ActionTest::copyPageFreeMode
\TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Modify\ActionTest::localizePage
Impact¶
Introduction of the new field is a base step for further refactorings, e.g.
- it opens a way to implement features like "reconnecting" free-mode translations back to the "connected mode"
- replace usage of the
t3_origuid
with thel10n_source
wheret3_origuid
is misused for language handling purposes (e.g. in LocalizationRepository)