Sorting of predefined language list doesn't work

Created on 30 September 2024, about 2 months ago

Problem/Motivation

When using "all predefined languages" in a language field, the list is sorted using the English language titles, even if one or more languages have a translation for the currently used interface language.

Steps to reproduce

  1. Install Drupal and add a second language (e.g., German)
  2. Install this module and configure a language field on a content type using "All predefined languages"
  3. Create a German node of that type
  4. In the entity form, the name of the German language is correctly translated to "Deutsch", but its position is below "Georgian" and not below "Danish".

The error seems to be in CustomLanguageManager::allowedValues(); while an attempt is made to sort the list of languages by value, this doesn't have any effect because the values are objects of type TranslatableMarkup, not strings.

Proposed resolution

Cast the values to string before sorting.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

User interface

Created by

🇩🇪Germany mrshowerman Munich

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

Comments & Activities

Production build 0.71.5 2024