Node type title_label override can have incompatible langcode

Created on 4 November 2019, about 5 years ago
Updated 28 February 2023, almost 2 years ago

Problem/Motivation

On multilingual sites, sitebuilders can lock themselves out from translating content types:

  1. Have a site with config_translation and locale
  2. Have at least 2 languages, e.g. English (en, default) and German (de)
  3. Add a content type test from the English backend (/en/admin/structure/types/add) with only a name => it is created with langcode: en
  4. Edit it to add a custom title field label from the German backend (/de/admin/structure/types/manage/test) => the field override is created with langcode: de
  5. Visit the translation overview page (/admin/structure/types/manage/test/translate) to view the error

The user is then greeted by this warning:

The configuration objects have different language codes so they cannot be translated:
node.type.test: en
core.base_field_override.node.test.title: de

It is no longer possible to fix this state using the UI provided by core, and it's also no longer possible to edit any translations until the situation is resolved.
(I suspect this situation can also happen in other situations, but the node type form is a very prominent case that's fairly easy to run into.)

I hope I didn't overlook an already existing issue, it's kind of hard to search for things like "node title label language". Issue #2571337: Node type title label cannot be translated in the UI is slightly related as it added the base field override to the node type translation form.

Proposed resolution

Workaround: Use drush or the devel config editor to completely delete or adjust the langcode of one of the two configurations.

This bug should be avoidable if a newly added base field override on existing node type entities is created in the entity's original language.

Remaining tasks

Write a test for the outlined steps to reproduce the bug, then write a patch to fix it.

🐛 Bug report
Status

Closed: outdated

Version

10.1

Component
Node system 

Last updated 4 days ago

No maintainer
Created by

🇩🇪Germany ckaotik Berlin

Live updates comments and jobs are added and updated live.
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.

  • 🇳🇿New Zealand quietone

    @ckaotik Thank you for reporting this problem and supplying a patch and a workaround We rely on issue reports like this to improve Drupal core.

    I tested this on 10.1.x, standard install, using Italian as the second language and was not able to reproduce this error. I followed the steps given in the Issue Summary.

    Therefore, closing as cannot reproduce. If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").

    Thanks!

Production build 0.71.5 2024