Bug #86231
Updated by Oliver Hader about 6 years ago
Based on my note https://forge.typo3.org/issues/86141#note-5 when analyzing the behavior
h2. TL;DR
When skimming over the examples below, focus and compare the values in @l10n_parent@ and realize that @l10n_source@ is *optional*.
h2. Usage
Localizations can be created using the graphical backend interface (e.g. page module) or by invoking direct commands to DataHandler [1]. Thus even if the page module is only valid for @tt_content@ records, it does not prevent records from being translated or localized explicitly. That's why this analysis used @element@ instead of @tt_conent@ a pointer to a database table holding relevant records.
h2. Terminology
h3. Connected Mode
When translating elements, each element is bound to it's relative ancestor. This results into a chain (that can be used for language fallbacks etc.).
The following example illustrates that, @l10n_parent@ always points to the initial record in default language, @l10n_source@ points to it's relative translation ancestor - that's the record a new translation is based on. All records are connected in a chain.
<pre>
+ element:1 - English (Default) - language:0, l10n_parent=0, l10n_source=0
+ element:2 - French Translation - language:1, l10n_parent=1, l10n_source=1
+ element:3 - Franco-Canadian Translation - language:2, l10n_parent=1, l10n_source=2
</pre>
h3. Free Mode
When localizing elements in free-mode, the previously mentioned translation chain is broken up, thus "free-mode localizaion elements" are in a specific language, but are not related to any relative ancestor and thus are idependent. The following example uses @element:3@ as "free-mode localization", @l10n_parent@ is set to @0@, but @l10n_source@ still points to it's relative localization ancestor (just as information, not as a strict relation in like a "composition" [2] would have been).
<pre>
+ element:1 - English (Default) - language:0, l10n_parent=0, l10n_source=0
+ element:2 - French Translation - language:1, l10n_parent=1, l10n_source=1
+ element:3 - Franco-Canadian Translation - language:2, l10n_parent=0, l10n_source=2
</pre>
h2. The Challenge
h3. Translation from from existing localization
It is possible, to create a new localization directly, that does not have a record in default language - or as alternative start a translation based on a "free-mode localization element".
The example shows, that the "English (Default)" record is now missing - the translation chain should(!) start with "French Translation" as first chain link. Since no record in default language s involved @l10n_parent@ stay empty with @0@, only @l10n_source@ point to their according relative ancestor records.
<pre>
+ element:2 - French Translation - language:1, l10n_parent=0, l10n_source=1
+ element:3 - Franco-Canadian Translation - language:2, l10n_parent=0, l10n_source=2
</pre>
When comparing the "Franco-Canadian Translation" here to the one shown in the "Free Mode" section, it cannot be distinguished anymore, whether the record is part of a "translation chain" or has been created as "free-mode localization".
h3. The information in @l10n_source@ is not mandatory
Besides that, the information stored in the @l10n_source@ field is optional and has to be configured in the control section of @$TCA@ using the @translationSource@ property. Thus, that information might not be available at all. The following examples show persisted results without having the @l10n_source@ information.
h4. Connected Mode without @l10n_source@
<pre>
+ element:1 - English (Default) - language:0, l10n_parent=0
+ element:2 - French Translation - language:1, l10n_parent=1
+ element:3 - Franco-Canadian Translation - language:2, l10n_parent=1
</pre>
It is not possible anymore to determine at all, whether a record is part of a translation chain - since the relative ancestor is missing.
h4. Free Mode without @l10n_source@
<pre>
+ element:1 - English (Default) - language:0, l10n_parent=0
+ element:2 - French Translation - language:1, l10n_parent=1
+ element:3 - Franco-Canadian Translation - language:2, l10n_parent=0
</pre>
It is (like in section "Translation from from existing localization") not possible to distinguish between "connected translations" and "free-mode localizations".
h2. References
[1]: DataHandler commands "localize" and "copyToLanguage": https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Typo3CoreEngine/Database/Index.html#command-keywords-and-values
[2]: Association, Aggregation, Composition in UML: https://www.visual-paradigm.com/guide/uml-unified-modeling-language/uml-aggregation-vs-composition/