When in translation mode, the non-translatable (shared) fields should be hidden.

IEF code:

  if (!empty($entity_form['#translating'])) {
      $langcode_key = $this->entityType->getKey('langcode');
      // Hide the non-translatable fields.
      foreach ($entity->getFieldDefinitions() as $field_name => $definition) {
        if (isset($entity_form[$field_name]) && $field_name != $langcode_key) {
          $entity_form[$field_name]['#access'] = $definition->isTranslatable();
        }
      }
    }

Comments

bojanz created an issue. See original summary.

berdir’s picture

This is related to #2463575: Wrong "all languages" in multilingual paragraphs

As @bojanz and I found out today, core switches dynamically between showing all fields with "All languages) suffixes and hiding them based on whether a user has permission to edit the original translation (He originally thought it is based on edit or add translation, but it's actually the permission).

Given that we're in an embedded case where space is always an issue, I'm leaning towards doing the same as IEF and hiding all fields. If there is a use case for showing them we can always add a new option and make it configurable.

Both issues will touch the same code, wondering if we want to work on them together.

agoradesign’s picture

I've noticed this problem yesterday with IEF: #2734623: Untranslatable boolean fields having FALSE as their original value cause EntityStorageException

I guess, it has to do with hiding the untranslatable fields, although this still looks strange and shouldn't be. Anyhow, you should try and test this scenario with Paragraphs too, once you've implemented that

luksak’s picture

I think parahraphs should follow the same pattern nodes do. This means not hiding untranslatable field except for certain edge cases (Eg. not having the edit permission, but the translate permission). Hiding fields is not going to be less confusing. The "(all languages)" label added by core should be improved in way that is clear and self-explanatory.

miro_dietiker’s picture

I just opened a long-overdue issue about hiding shared actions while translating: #2932344: [META] Hide shared actions when translating

Once this is fixed, the next item to discuss translation wise is hiding shared fields, at least optionally. Also core currently discusses how to improve the indication of these fields.

anybody’s picture

Might this issue be related? #3239576: Multilingual paragraphs: "[HIDDEN TRANSLATED] field is required. " if hidden subfield is required Also for others who may run into that problem...