Translations of nodes with comment settings field set to non-translatable returns EntityUntranslatableFieldsConstraint

Created on 23 November 2018, over 5 years ago
Updated 30 January 2023, over 1 year ago

Problem/Motivation

It is impossible to add a new translation in case the user wants to keep the same settings for comments across all translations of the node.

Steps to reproduce

  1. Install standard
  2. Install content translation
  3. Add language (in my case Polish)
  4. Go to content translation settings and make Article translatable. Only check Title and Body field, unselect the rest, especially the Comments field. Also select "Hide non translatable fields on translation forms"
  5. Create a node in default language (English)
  6. Go to the Translate tab and add Polish translation.
  7. Fill the form and submit.
  8. "Non-translatable fields can only be changed when updating the original language."

Proposed resolution

CommentFieldItemList needs to implement it's own hasAffectingChanges that only check if status property has changed. If not it will check all properties, included the computed once like:

  • status
  • cid
  • last_comment_timestamp
  • last_comment_name
  • last_comment_uid
  • comment_count

And these properties will all be set to 0 until the new entity revision has been saved.

hasAffectingChanges in FieldItemList simply check !$this->equals($original_items);
https://git.drupalcode.org/project/drupal/-/blob/8.8.x/core/lib/Drupal/C...

However in the hasAffectingChanges doc it is written:

/**
* Determines whether the field has relevant changes.
*
* This is for example used to determine if a revision of an entity has
* changes in a given translation. Unlike
* \Drupal\Core\Field\FieldItemListInterface::equals(), this can report
* that for example an untranslatable field, despite being changed and
* therefore technically affecting all translations, is only internal metadata
* or only affects a single translation.

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
CommentΒ  β†’

Last updated 2 days ago

Created by

πŸ‡³πŸ‡΄Norway zaporylie

Live updates comments and jobs are added and updated live.
  • D8MI

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot β†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

Production build 0.69.0 2024