Views Taxonomy dropdown filter is not ordered alphabetically

Created on 29 September 2015, about 9 years ago
Updated 6 September 2024, 4 months ago

Problem/Motivation

Views dropdown filter is not ordered alphabetically on a multilingual site. Instead, it will use all language versions of each term to sort the list. For example if you have a site in english and french and you have a list of fruits:

  • EN: Banana / FR: Banane
  • EN: Pineapple / FR: Ananas

Your list on the english version of the site will be the following:

  1. Pineapple
  2. Banana

Because 'Ananas' is the first one alphabetically and sorting doesn't care about language versions.

Proposed resolution

Make sorting work as expected.

I have found a solution to this problem BUT the solution hides all terms which do not have a translation to the current language. If this is acceptable, we can do the following changes to the entity query which finds the terms:

  1. Add langcode parameters to the sort() calls
  2. Add a langcode condition (only terms of the current language will be shown)

We could do only the first part. But that will cause problems with terms that are not translated. For example if 'Pineapple' is not translated to english, but 'Banana' is translated to english, 'Pineapple' will be listed first. So this is why I also added the second part, the langcode condition.

Remaining tasks

  1. Figure out if it's acceptable to hide terms which do not have a translation to the current language

User interface changes

  1. Terms are listed alphabetically
  2. Term will be hidden if it doesn't have a translation to the current language

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
TaxonomyΒ  β†’

Last updated 15 minutes ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @xjm
  • πŸ‡¬πŸ‡§United Kingdom @catch
Created by

πŸ‡ΉπŸ‡­Thailand juhog

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

Merge Requests

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