Feature: #78169 - Introduce "Translation Source" field for tt_content
See forge#78169
Description
The new database field l10n_
for tt_content table has been introduced together with a new TCA ctrl configuration translation
.
The translation
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 translation
contains column name, similar to the trans
.
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
trans
(e.g.Orig Pointer Field l10n_
) field, it means it was translated using "connected mode". If theparent trans
is 0 but theOrig Pointer Field translation
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.Source - 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
translation
field always contains a uid of the record used as a translation source.Source - In some places
orig
(e.g.Uid t3_
) fields were misused as a translation source. Now these places can be refactored to use theoriguid translation
field.Source
Difference between translationSource
and other existing fields
trans
(e.g.Orig Pointer Field l10n_
) - "translation parent" - this field contains uid of the record in the default language representing the same content. Theparent translation
field can contain a uid of the record in non-default language.Source orig
(e.g.Uid t3_
) - "copy source" - this field contains uid of the record, current record was copied from. It might be equal tooriguid translation
as localization is a copy internally, but often it is different.Source
See following test scenarios to see how data is handled in details.
\TYPO3\
CMS\ Core\ Tests\ Functional\ Data Handling\ Regular\ Modify\ Action Test:: localize Content \TYPO3\
CMS\ Core\ Tests\ Functional\ Data Handling\ Regular\ Modify\ Action Test:: localize Content From Non Default Language \TYPO3\
CMS\ Core\ Tests\ Functional\ Data Handling\ Regular\ Modify\ Action Test:: copy Content To Language \TYPO3\
CMS\ Core\ Tests\ Functional\ Data Handling\ Regular\ Modify\ Action Test:: copy Page \TYPO3\
CMS\ Core\ Tests\ Functional\ Data Handling\ Regular\ Modify\ Action Test:: copy Page Free Mode \TYPO3\
CMS\ Core\ Tests\ Functional\ Data Handling\ Regular\ Modify\ Action Test:: localize Page
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_
with theoriguid l10n_
wheresource t3_
is misused for language handling purposes (e.g. in LocalizationRepository)origuid