Skip to content

Add check for: Inconsistent values for fields with allowLanguageSynchronization? #97

@sypets

Description

@sypets

AFAIAA, translated records should have the same value of the default language record for a field if,

  • allowLanguageSynchronization=1 for the field
  • l10n_state has "parent" set for the field (not "custom") or has no definition for the field (e.g. l10n_state is empty where the default would be "parent")
  • there is a valid language parent, identifiable by the field defined by TCA transOrigPointerField, e.g. l18n_parent

I noticed there are several mismatches for these fields in our site for extension fields, but also core fields such as pages.url, pages.no_search, pages.author etc.

I assume this can happen if:

  • the TCA configuration was changed after the records were created (and no upgrade wizard supplied or was not executed)
  • the language parent was changed, e.g. if pages were translated in "free" mode and manually connected afterwards

Possible solution

The "dbdoctor" HealthCheck can

  1. get all fields with allowLanguageSynchronization
  2. For each table / field do a JOIN on the table and compare value of record with value of default lang (if conditions described above are met, e.g. l10n_state etc.)
  3. UPDATE: either
    a) set the value to the value of the default language
    b) OR change l10n_state for the field from fieldname: "parent" to fieldname: "custom" (if the value differs)

Changing the value might be a problem in some cases (e.g. pages.url) because they should be different for each language and were originally edited as such. So, I think solution b) would be "safer". (but there are also cases with other field where it's the other way around 😦)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions