Review main Merged

65961[BUGFIX] Restore recordlist localization behaviour

Oli Bartsch CR +2 V +2 Normal +41 −17 updated 10/02/20, 12:45

Commit message

With #92133 the translation and localization behaviour within
recordlist was streamlined. Thereby some changes were made
that led to unexpected changes. These are now fixed.

The LocalizationPanel is not shown anymore for records which are
already localized in all possible languages, are in free mode or
have sys_language_uid -1 set.

This is achieved by taking the TranslationConfigurationProvider::translationInfo()
result into account again.

The indentation of the "Localization" column on localized rows
is added again. Furthermore, a misbehaviour is fixed in which
the rows' l18n_parent field was checked directly instead of the
defined transOrigPointerField field. As a result, the indentation
was only applied to tt_content rows as this is the only core table
having l18n_parent as transOrigPointerField configured.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Daniel Windloff +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Daniel Windloff +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 1519

  1. Oli Bartsch uploaded patch set 1 09/29/20, 21:12

  2. Oli Bartsch uploaded patch set 2 09/29/20, 21:26

  3. TYPO3com voted on patch set 1 V -1 09/29/20, 21:37 Completed build in 22m 37s on Tue, 29 Sep, 09:37 PM Test Summary: 1 of 74175 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6077

  4. TYPO3com voted on patch set 2 V +1 09/29/20, 21:45 Completed build in 18m 41s on Tue, 29 Sep, 09:45 PM Test Summary: 73690 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6078

  5. Daniel Windloff commented on patch set 2 09/30/20, 06:44

    Hey Oliver, thank you for bringing this up. Alternatively, you could ping me if I cause regressions during refactoring. I'll provide bugfixes for that. The main problem here is, that there is no general definition, how the translation modes should work for all kinds of records and the current translation mode is currently unknown in the list module. Should I add a patch set reflecting my comments?

    DatabaseRecordList.php:2186

    This would not work in the following situation: - default language and one possible translation - connected mode - one additional record in default language No localization possible as there is no translation for this record. To resolve the current regressions, it needs additional guard clauses for language -1 and language > 0

    DatabaseRecordList.php:2188

    There is currently no information about the translation mode in place. That's why, it is more or less unknown if a record is in the free or mixed mode. The current query in translationInfo does not take the colpos into account as there is no TCA configuration for that. So the result should not be the same as in the page module. As far as I know, there is no definition how the translation modes should be calculated for non tt_content or pages records.

    DatabaseRecordList.php:2192

    I think translations will return all the current translations of the record. Otherwise, the translated records would not be rendered at all.
  6. Oli Bartsch commented on patch set 2 09/30/20, 07:39

    > Patch Set 2: > > (3 comments) > > Hey Oliver, > thank you for bringing this up. > Alternatively, you could ping me if I cause regressions during refactoring. I'll provide bugfixes for that. > > The main problem here is, that there is no general definition, how the translation modes should work for all kinds of records and the current translation mode is currently unknown in the list module. > > Should I add a patch set reflecting my comments? Hi, great to hear. I was just discovering these and created a patch as basis for further discussions. And yes, I was also confronted with this problem. So for me the prior state should be restored for now. Additionally we could talk about allowing localization of L>0 records if not connected to L=0 ("Free mode"). This however currently has some bugs (see my comment below).

    DatabaseRecordList.php:2186 Reply

    I've tested it and can't confirm these points. I'm still able to localize from default to any possible language (also if only one is possible and also if one possible and one already localized). Connected mode is IMO just the term for content following the l10n_parent is record in L=0 strategy. See DatabaseRecordList:927 where -1 is already checked.

    DatabaseRecordList.php:2188 Reply

    Right. What I mean is a record in L>0 but without l10n_parent or l10n_source. "Mixed mode" is only a term within page module for tt_content while recordlist must deal with all kinds of records. So I see following possibilities for the records: 1. L=0 (default) => Can be localized in available languages 2. L=-1 (ALL) => Can't be localized as it is used for all languages 3. L>0 with l10n_parent => Can't be localized as it is already a localization of a default record ("connected mode") 4. L>0 with l10n_parent and l10n_source NOT set => Can't be localized as it is already a localization ("Free mode") 5. L>0 with l10n_source => Can't be localized as it is already a localization of a L>0 record ("Free mode") The above behaviour is the previous one - prior to the patch. It may be possible to allow localization of 3. and 4. (like already possible in page module - see also #92440) in the future but there is still some work to do. Currently localizing such records led to a /record/commit call, redirecting to /record/edit/ which then never returns to the recordlist so you are left within a loading FormEngine which never finish loading. Furthermore translating L=X to L=X doesn't seem right, so we also have to prevent this.

    DatabaseRecordList.php:2192 Reply Unresolved

    According to the PHPDoc and the tests I did, the translationInfo() either returns the array with information about translations of the record, which is then used in DatabaseRecordList:930 `$translations = $translationsRaw['translations'];` or an error message. In this case $translations remains empty as the condition in DatabaseRecordList:929 is not met.
  7. Oli Bartsch commented on patch set 2 09/30/20, 07:50

    DatabaseRecordList.php:2188 Reply

    5. can also be "connected mode" if l10n_parent is the L=0 records and the l10n_source is a L>0 record. That's the case when you translate a default record in page module and then translate the L>0 record again in another language selecting "Translate" in the wizard. "Free mode" would be if you select "Copy".
  8. Daniel Windloff commented on patch set 2 09/30/20, 18:37

    DatabaseRecordList.php:2186 Reply

    I try to describe my setup in detail: - Create a sites configuration with two languages - Add a subpage to the rootpage (of the sites configuration) - Translate the subpage - Create a record in the default language - Localize the record isn't possible. $this->possibleTranslations has an entry with the possible translation. $translations is an empty array. That's why the localization is not possible. What resolves the all languages and free mode issues in my test case is to have the following guard clauses in place: if ((int)$row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] !== 0) { return ''; } if ((int)$row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] !== 0) { return ''; }

    DatabaseRecordList.php:2188 Reply Unresolved

    Yes, to have the same behavior would be great.
  9. Daniel Windloff commented on patch set 2 09/30/20, 18:46

    The problem with the current codebase is the limited possibility to test: Usually a couple of functional tests would do the job to nail down and fix them the needed cases.
  10. Oli Bartsch uploaded patch set 3 10/01/20, 07:32

  11. Oli Bartsch commented on patch set 3 10/01/20, 07:40

    DatabaseRecordList.php:2186 Reply Unresolved

    You are right, that would only work if already at least one translation exist. I updated the patch to exactly reflect the old bevhaviour by checking the translationInfo result for array (see: https://github.com/TYPO3/TYPO3.CMS/blob/v10.4.9/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php#L2338) and only create the panel if this is true. This is now achieved by a flag which defaults to FALSE and is only set to TRUE if the translationInfo result is an array. Could you please have a look again.
  12. TYPO3com voted on patch set 3 V +1 10/01/20, 07:46 Completed build in 13m 36s on Thu, 1 Oct, 07:46 AM Test Summary: 73690 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6112

  13. Georg Ringer commented on patch set 3 10/01/20, 14:03

    DatabaseRecordList.php:3698

    imo we don't align those but have 1 whitespace

    DatabaseRecordList.php:3702

    would prefer name "isLocalized"
  14. Oli Bartsch uploaded patch set 4 10/01/20, 15:17

  15. Oli Bartsch commented on patch set 4 10/01/20, 15:17

    DatabaseRecordList.php:3698 Reply

    Done

    DatabaseRecordList.php:3702 Reply

    Done
  16. TYPO3com voted on patch set 4 V +1 10/01/20, 15:36 Completed build in 19m 24s on Thu, 1 Oct, 03:36 PM Test Summary: 73690 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6126

  17. Daniel Windloff voted on patch set 4 V +1 CR +1 10/02/20, 10:40

  18. Christian Kuhn voted on patch set 4 V +2 CR +2 10/02/20, 12:44

  19. Christian Kuhn merged patch set 5 10/02/20, 12:45