Group name does not display localized label in field widgets

Created on 8 August 2022, over 2 years ago
Updated 20 June 2023, over 1 year ago

Problem/Motivation

When a group has a translation, the group name is properly displayed in the select list but the translated value does not display after the group has been selected.

Steps to reproduce

1. Set up a site with translations with at least one additional language
2. Create a group with multiple languages
3. Set the user's language to the alternate language
4. Create a node with a form field that is "Group select"
5. Select the Group (which has the localized name) from the dropdown menu
6. Save the node

The group name displayed is not the localized value for the language of the user

Proposed resolution

See patch (note this is the same method the select field's options use)

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Widgets

Created by

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.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    4 pass
  • πŸ‡ΊπŸ‡ΈUnited States dww

    Thanks for the issue and the patch! I was able to reproduce this. The patch worked as advertised.

    However, in local testing, I also tried deleting a group association via the widget, and in that case, the group name is once again displayed in the original language, not the translation.

    So here's an updated patch that handles both.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    4 pass
  • πŸ‡ΊπŸ‡ΈUnited States dww

    Also, while it'd be great to have tests for this, there aren't currently any translation-related tests, and I'm not going to require them to move forward here. πŸ˜…

Production build 0.71.5 2024