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)

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bbeversdorf created an issue. See original summary.

bbeversdorf’s picture

StatusFileSize
new1.02 KB
dww’s picture

Title: Group Name Does Not Display Localized Value » Group name does not display localized label in field widgets
StatusFileSize
new1.25 KB

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.

dww’s picture

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. 😅

dww’s picture

Version: 1.0.x-dev » 2.0.x-dev
Status: Needs review » Needs work
Issue tags: +Needs merge request

I want to get this in before next round of releases. First, need to make it an MR and ensure pipelines are still cool.

dww’s picture

Status: Needs work » Needs review
Issue tags: -Needs merge request

  • dww committed 785ea632 on 2.0.x
    fix: [#3302321] Group name does not display localized label in field...

  • dww committed 3197ee8b on 1.0.x
    fix: [#3302321] Group name does not display localized label in field...

dww’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.