Dangling translations after content translation is disabled for an entity type

Created on 14 November 2024, 5 months ago

Problem/Motivation

Translation records remain in the database long after translation has been disabled on an entity type. This causes an error when updating a node with the "Provide a menu link" option enabled.

Steps to reproduce

  1. Say, a content entity is translatable. In my case, it was menu_link_content.
  2. I create a node and add a menu link to it in English, and say, I translate it to Portuguese.
  3. After a few months, translations are disabled on the menu_link_content. Say, the client wants to have different menus for different languages to have more control.
  4. Observe:At this point, translations are disabled, but there are translation records in the database.
  5. In some cases, the @menu_ui_form_node_form_submit()@ gets confused due to this and ends up causing an exception.
  6. Additionally, the translations stay in the database forever even though they have been disabled.

I haven't tested this with other entity types, but it is highly probable that the same happens with them.

Proposed resolution

Create a mechanism to perform garbage collection on such dangling translations.

Remaining tasks

* Decide how to do it
* Do it

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.1 🔥

Component

config_translation.module

Created by

🇨🇦Canada jigarius Montréal

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jigarius
  • Translation records remain in the database for entities like menu_link_content long after translations have been disabled. This results in errors, specifically during node updates when the "Provide a menu link" option is checked, causing exceptions when attempting to process outdated translation references.

    Create a mechanism to perform garbage collection on dangling translations.

    Add a new section in the admin UI under Configuration for managing translation settings. This includes:
    A toggle switch to enable or disable automatic cleanup of unused translations when translations are disabled for an entity type.
    A button to manually trigger the cleanup process, allowing administrators to clear dangling translations on demand.

  • 🇳🇿New Zealand quietone

    Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies.

Production build 0.71.5 2024