Issue Bug Under Review

#65859Support l10n_mode in extbase

Peter Niederlag 03/20/15, 09:41 updated 11/11/26, 09:13

Description

Intro

Currently extbase lacks support for l10n_mode.

See #62921 for a lengthy discussion of the background. From my point of view support for l10n_mode must explicitly be enabled/added in extbase, that’s why I duplicated #62921 here.

Use Case

As Developer I want to be able to assign a relation on a record in the default translation that must not be changed in the translation of the record.
When I set l10n_mode=exclude in $TCA
When I use the \TYPO3\CMS\Extbase\Persistence\QueryInterface to lookup records by a category
Then I expect to find translated records in the Frontend

//$TCA
'faculty' => array(
            'exclude' => 0,
            'l10n_mode' => 'exclude',
            'l10n_display' => 'hideDiff,defaultAsReadonly',
            'label' => 'LLL:EXT:luhjobs/Resources/Private/Language/locallang_db.xlf:tx_luhjobs_domain_model_vacancy.faculty',
            'config' => array(
                'type' => 'select',
                'foreign_table' => 'tx_luhjobs_domain_model_faculty',
                'foreign_table_where' => 'AND tx_luhjobs_domain_model_faculty.sys_language_uid IN (-1,0)',
                'items' => array(
                    array('',''),
                ),
                'minitems' => 1,
                'maxitems' => 1,
            ),
        ),
// QueryInterface
$constraints[] = $query->equals('faculty', $uid);
// resulting SQL(relevant parts only) in case of Frontend with ?L=1
tx_luhjobs_domain_model_vacancy.type = '19' AND tx_luhjobs_domain_model_vacancy.intern = 0
)
AND
(
    tx_luhjobs_domain_model_vacancy.sys_language_uid IN (1,-1)
    OR
    (
        tx_luhjobs_domain_model_vacancy.sys_language_uid=0 AND tx_luhjobs_domain_model_vacancy.uid NOT IN
            (
                SELECT tx_luhjobs_domain_model_vacancy.l10n_parent FROM tx_luhjobs_domain_model_vacancy WHERE tx_luhjobs_domain_model_vacancy.l10n_parent>0 AND tx_luhjobs_domain_model_vacancy.sys_language_uid=1 AND tx_luhjobs_domain_model_vacancy.deleted=0
            )
    )
)

This does miss the translated records as they have faculty=0 due to the l10n_mode=exclude setting in $TCA

Reviews 3

History 1533

Show 8 earlier messages
  1. Benni Mack commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2018-07-19T08:48:24+00:00" > 07/19/18, 08:48 </span>

    Peter, I guess this is now fixed with TYPO3 v8, can you verify this?

  2. Johannes Rebhan commented <span data-processor="relativetime" data-value="2018-09-25T13:10:49+00:00" > 09/25/18, 13:10 </span>

    @Benni

    Sadly it’s not fixed with v8. I’ve run into the same problem where I have an object which has categories in the base language, then I translate said object with extbase, assign the original object and save it.

    The categories field is set as l10n_mode = exclude, but it doesn’t work when using core extbase. It seems to work in the backend, because when I edit the translated object (no categories selection shown) and save it – without changing anything – the values are copied. When I do the same in extbase by loading the translated object through a querybuilder query (can’t get it any other way in the backend/commandcontrollers), which is then mapped to the object by using DataMapper, it doesn’t apply those TCA settings after I’ve stored with through a repository update().

  3. Tymoteusz Motylewski commented <span data-processor="relativetime" data-value="2018-11-03T19:45:05+00:00" > 11/03/18, 19:45 </span>

    So querying works but data is not propagated when saving a record through extbase?
    This is because extbase doesnt use datahandler for storing values.

  1. Riccardo De Contardi changed status Needs Feedback New TYPO3 Version 6.2 10 <span data-processor="relativetime" data-value="2021-09-15T19:27:04+00:00" > 09/15/21, 19:27 </span>

  2. Jan Kornblum commented <span data-processor="relativetime" data-value="2022-02-03T22:50:09+00:00" > 02/03/22, 22:50 </span>

    Tymoteusz Motylewski wrote in #note-7:
    > So querying works but data is not propagated when saving a record through extbase?

    Regarding querying, possibly still a (minor) bug: Lets have “product” with two relations “type” (n:1) and “categories” (m:m). For all records (products, types, categories) a translation (L=1) exists.

    Now products are queried using the following, while L=1 (and fallbackType=fallback):

    // MM - Works fine
    $query->contains('categories', $category)
    // N:1 - Does NOT work (no records fetched)
    $query->equals('type', $type)
    // N:1 - DOES work instead (why?)
    $query->equals('type', $type->getUid())

    Seems there is something missing regarding n:1 relations, when the operand is localized.

  3. Gerrit Code Review pushed patch set 18 for main to change 67172 status New Under Review <span data-processor="relativetime" data-value="2024-03-17T11:43:00+00:00" > 03/17/24, 11:43 </span>