Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sypets opened this issue Nov 30, 2023 · 1 comment · May be fixed by #98
Open

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

sypets opened this issue Nov 30, 2023 · 1 comment · May be fixed by #98
Labels

Comments

@sypets
Copy link
Contributor

sypets commented Nov 30, 2023

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 😦)

@sypets
Copy link
Contributor Author

sypets commented Nov 30, 2023

Would you be interested in adding this healthcheck?

Would you be interested in a PR? (I have a patch which is almost finished)

Which solution would you use (see above): 3a (change the value) or 3b (change l10n_state) or ...?

sypets added a commit to sypets/dbdoctor that referenced this issue Nov 30, 2023
In case TCA allowLanguageSynchronization=1 is set the value of
a translated record should be the same as the value in the
default language, unless l10n_state contains a configuration
for the field != "parent" (e.g. "custom").

In this case the value is inconsistent because "Use value from
default language" is displayed in the BE, but the value is
actually different.

For better consistency, we change the configuration in l10n_state
for these cases to "custom".

Resolves: lolli42#97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants