Widget does not always load the correct term translation

Created on 2 September 2021, about 3 years ago
Updated 6 September 2024, 3 months ago

Problem/Motivation

This was already partially tackled in https://www.drupal.org/project/cshs/issues/3189846 however the fix there assumes that that the original language of the term always matches the default site language. In cases where this isn't true the original language version is still loaded in the widget.

Steps to reproduce

  1. Set up a site with 2 languages, e.g. - English & German
  2. Set English as the site default language
  3. Create a translatable vocabulary
  4. Add some English terms, translate them to German
  5. Add some German terms, translate them to English
  6. Add a term reference field to a node type, set up the cshs widget
  7. Try to add a node in the English version of the site - the originally German terms will still show their source language version in the widget instead of the translation

Proposed resolution

Instead of checking if the content language matches the site default language to determine whether a translation needs to be loaded compare the actual langcode of the term to the content language.

🐛 Bug report
Status

Needs work

Version

4.0

Component

Code

Created by

🇱🇻Latvia artis.bajars

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

Production build 0.71.5 2024