Page MenuHomePhabricator

Basic support for a responsive language selector
Closed, ResolvedPublic8 Estimated Story Points

Assigned To
Authored By
Pginer-WMF
May 21 2020, 12:52 PM
Referenced Files
F72273918: image.png
Feb 23 2026, 9:08 AM
F72207426: irudia.png
Feb 20 2026, 1:27 PM
F72207423: irudia.png
Feb 20 2026, 1:27 PM
F72207401: irudia.png
Feb 20 2026, 1:27 PM
F71755269: image.png
Feb 10 2026, 9:53 AM
F71755257: image.png
Feb 10 2026, 9:53 AM
F71755247: image.png
Feb 10 2026, 9:53 AM
F35068586: SXServer_Story_test_T253303.docx
Apr 26 2022, 1:35 PM

Description

Different steps of the Section Translation process (T243495) require language selection. This is an opportunity to create a standard language selection component in Vue that other products could reuse (T287860). This ticket captures the basic behaviour to support language selection.

Overview

The language selector shows a list of languages available for the user to select. Languages are listed using their name in their own language (i.e., the autonym). The number of languages provided in the selector is variable and can be potentially large. The selector supports searching, surfacing frequent languages, and adjusting the layout to the number of languages.

Overview Copy 22.png (768×1 px, 72 KB)

Overview of the selection process:

  • Open the selector. The language selector opens after the user taps on an action (e.g., button) or selection (e.g., drop-down) control. The design of these entry points is out of the scope of the current task. A button can be used for testing purposes.
  • Search. The user types a search query that filters the list of languages shown.
  • Select a language. Taping on a language from the list completes the selection. Closing the selector automatically and making the selected value available to the product using the selector.
  • Close the selector. The selector closes when taping outside the selector, pressing "esc" key or with a close action available on narrow screens. This cancels the selection.

Overview Copy 24.png (768×1 px, 63 KB)

Responsive layout

The layout is adapted to the following factors:

Number of languages

  • 0–9 languages. Suggested languages are hidden. The list of languages has no label, and uses one column.
  • 10-29 languages. Suggested languages are shown using 2 columns. The list of languages uses one column. Both lists are labelled.
  • 30 or more languages. Suggested languages are shown. The lists of suggested and all languages use 3 columns (on wide screens). Additional space is added after each block of 5 rows.
0–9 languages10-29 languages30-* languages
short.png (310×348 px, 11 KB)
default.png (310×348 px, 19 KB)
3cols-and-suggested.png (448×512 px, 40 KB)

Screen size

  • Narrow screen. The selector is shown as a full screen dialog. The list of all languages always uses one column.
  • Wider screen. The selector is shown as a dialog over existing content. The list of all languages can use one or three columns depending on the number of languages (see above). The length of the selector will adapt to the available languages with a max height of 312px.
Wide screenNarrow screen
Group.png (572×904 px, 41 KB)
mobile.png (669×348 px, 34 KB)

Product preferences

  • Option to hide suggested languages. Suggested languages are shown by default when there are 10 languages or more available. However, this list is optional and apps have the option to hide the suggested languages list. In such case, the list of all languages will be shown without a title label.

The layout specifications for the different cases are captured below:

Layout spacing.png (768×1 px, 88 KB)
Layout spacing narrow.png (768×1 px, 60 KB)

Styling notes

Some notes on styling for the different pieces of the selector.

Main panel:

  • Background: white (Base100)
  • Border: 1px in Base70 with 2px radius.
  • Shadow: Base0 at 25% opacity 1px down, 2px of blur

Text styles:

  • Default: Standard body text (sans-serif 16 px in Base10)
  • List title ("suggested", "All languages"): Base30

Header:

  • Separator lines: 1px in Base70

Search bar:

  • Shadow: Base0 at 25% opacity 1px down, 2px of blur
  • Border radius: 2px radius on top corners, straight corners at the bottom.

Hover and focus states

Group.png (316×354 px, 21 KB)

  • Search bar focus state will use the 2px Accent50 border, the standard for input boxes.
  • Language in the list are highlighted with a Base80 on hover.

Search

We may want to reuse existing search components.

Considerations for search:

  • The search box gets the input focus automatically when the selector is opened.
  • User input filters the list of languages based on prefix search as the user types. Search will be case insensitive. When searching, only the search results are displayed (no separate list for "suggested"). See example below.
  • Searching should not change the dialog width. If a wide three-column version of the dialog is shown based on the large number of languages shown initially, searching should not result in the dialog to become narrow despite reducing the number of languages displayed. This avoids unnecessary distraction (as described in T286514).
  • The search API for the current language selector can be reused to support flexible search capabilities (e.g., finding a language name written in any other language)
  • Type-ahead autocompletion will add text after the search term to complete it when a matching language is found. For example, when typing "engli" the autocompletion text will show "sh" in grey to suggest "English" to the user.
  • The search text is cleared when the selector gets closed. That is, previous searches should not remain visible when the selector is opened again.

filtered.png (310×348 px, 8 KB)

Suggested languages

  • The selector displays up to six suggested languages, using two or three columns depending on the number of languages (see responsive layout section).
  • By default suggested languages
  • Apps opening the selector can provide their own list of suggested languages, or hide the list.
  • When suggested languages are not show (or the list is empty), the list of "all languages" will have its title hidden.

Keyboard and pointer support

  • "Esc" key would cancel the selection and close the selector.
  • Arrow keys can be used to move through the options. The active item will be shown with a Base80 background.
  • "Enter" would confirm the selection. Selecting the first results while searching, or the focused element while moving through the options.
  • Hovering a language will show it with a Base80 background.

Group.png (316×354 px, 21 KB)

Sorting languages

Languages order considers their script and their label:

  • Languages are ordered based on the alphabetical of their label (which is the autonym by default).
  • All languages based on one script family are displayed before the languages of a different script. The order of the script families is defined in language data library.

Multiple columns use vertical lists:

  • Columns are divided in blocks of 5 items listed vertically.
    • Suggested languages area displays only 2 items per column since the area is limited to a total of six options.
  • Once all columns are completed, a gap (24px) separates the next block of columns.

The ordering through multiple columns is organized to optimize the scan line. That is, reducing the number of saccades (eyes jumping to the next line). This is illustrated in the image below:

Layout spacing narrow Copy.png (768×1 px, 130 KB)

Further context

This ticket covers only the basic aspects for the selector. Additional usecases requiring additional information, actions, or selection modes will be supported in separate tickets:

For a deep dive on how all these fit together you can check this document.

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Pginer-WMF added a subscriber: EChukwukere-WMF.

Moving to QA for a detailed review by @EChukwukere-WMF. This ticket captures many aspects of the new language selector (behaviour, styling, layout, spacing, etc.). We want to make sure that the current implementation present in Section Translation aligns with those details or the missing ones are captured in separate tickets to be implemented in the future (note that some of the later were listed in T253303#7252578 already).

@santhosh You did mention earlier that that the "Arrow key based selection" was not implemented in the first iteration. I want to know if it was later implemented as I did mark this as failed. Let me know if it will be part of the deliverable for this story

@Pginer-WMF I did mark a couple of the Acceptance criteria under this story as failed and will probably move it back to dev
see attached

Feedback
I did also discover other things that does not have to be under this deliverable but can go into future tickets. They are quality ( more of UI/UX) issues that will need attention as we dive deeper. Please advise on what you decide to do

see attached

@santhosh You did mention earlier that that the "Arrow key based selection" was not implemented in the first iteration. I want to know if it was later implemented as I did mark this as failed. Let me know if it will be part of the deliverable for this story

Keyboard based navigation support was later added in this commit https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ContentTranslation/+/698453/

@santhosh ok if that's the case , it does not seem to work. I can move this out of the QA column back to dev. please see the attachments

let me know what you think.

KartikMistry changed the task status from Open to In Progress.May 11 2022, 10:43 AM

@Pginer-WMF It is unclear on what is remaining on this ticket. Since this is not an active area we are working these days, I suggest we either close or park it out of current sprint.

@Pginer-WMF It is unclear on what is remaining on this ticket. Since this is not an active area we are working these days, I suggest we either close or park it out of current sprint.

Ok. Let's move it to the backlog.
For future reference there are a couple of missing pieces identified by Emeka in T253303#7880877.
When we focus on this again, I'll take another look and create follow-up tickets as needed based on that.

@Pginer-WMF Yes we can close this ticket and reopen bugs based on the comments I made above. Thank you

Aklapper changed the task status from In Progress to Open.Mar 22 2025, 7:24 AM

Resetting task status from "In Progress" to "Open" as this task has been "in progress" for more than two years.

Nikerabbit lowered the priority of this task from High to Low.Jun 5 2025, 2:48 PM
Nikerabbit moved this task from Needs Triage to Dashboard on the ContentTranslation board.
Nikerabbit subscribed.

Suggesting to wait until we work on ULS rewrite to see if we can avoid duplicated code and efforts.

Change #1235324 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/UniversalLanguageSelector@master] Add UniversalLanguageSelector Vue component

https://gerrit.wikimedia.org/r/1235324

Change #1237539 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/core@master] useLanguageSelector: Expose isSearching state

https://gerrit.wikimedia.org/r/1237539

abi_ changed the task status from Open to In Progress.Feb 8 2026, 2:47 PM
abi_ claimed this task.
abi_ raised the priority of this task from Low to High.
abi_ lowered the priority of this task from High to Low.
abi_ raised the priority of this task from Low to High.
abi_ set the point value for this task to 8.
abi_ moved this task from Backlog to In Progress on the LPL Essential (FY2025-26 Q3) board.

Test wiki created on Patch demo by APatro (WMF) using patch(es) linked to this task:
https://db6e363841.catalyst.wmcloud.org/w/

Test wiki created on Patch demo by APatro (WMF) using patch(es) linked to this task:
https://08f051f721.catalyst.wmcloud.org/w/

Test wiki on Patch demo by APatro (WMF) using patch(es) linked to this task was deleted:

https://db6e363841.catalyst.wmcloud.org/w/

Building and borrowing on the work on Santosh, Nik and others, I've built a new language selector inside the ULS extension.

  • Responsive layout - suggested languages are skipped for now. I'll track this work under T287877: Language selector: Show suggested languages. The layout spacing is kept as per Codex specifications. Similarly styling has been kept as per Codex specifications. All other requirements have been implemented as per the task description.
  • Search - typeahead search functionality has been pulled into a separate ticket (T416908: Language selector: Implement type ahead autocompletion when searching for a language). Rest of the functionality is implemented as specified.
  • Suggested languages functionality will be implemented as part of T287877: Language selector: Show suggested languages
  • Keyboard and pointer support - Functionality has been implemented as specified
  • Sorting languages - Languages are ordered based on their script and label as specified but the ordering is done from left to right instead of top to bottom. I think this offers a more natural experience and reduces eye movement.

I'm trying to setup a patchdemo instance to allow for easy testing but until then here are some screenshots.

Screenshots

< 10 languages:

image.png (446×844 px, 64 KB)

> 30 languages:

image.png (441×844 px, 56 KB)

Mobile device or narrow screens:

image.png (831×403 px, 35 KB)

Change #1239999 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/UniversalLanguageSelector@master] ULS Rewrite: Add support for displayng supported languages

https://gerrit.wikimedia.org/r/1239999

Test wiki created on Patch demo by APatro (WMF) using patch(es) linked to this task:
https://763194ebe4.catalyst.wmcloud.org/w/

Test wiki on Patch demo by APatro (WMF) using patch(es) linked to this task was deleted:

https://763194ebe4.catalyst.wmcloud.org/w/

Test wiki on Patch demo by APatro (WMF) using patch(es) linked to this task was deleted:

https://08f051f721.catalyst.wmcloud.org/w/

Test wiki created on Patch demo by APatro (WMF) using patch(es) linked to this task:
https://4746513a95.catalyst.wmcloud.org/w/

  • Sorting languages - Languages are ordered based on their script and label as specified but the ordering is done from left to right instead of top to bottom. I think this offers a more natural experience and reduces eye movement.

Going sideways is the natural way when reading contents. However, when scanning lists (such as an index in a book) vertical scanning can be more efficient. In this particular case, it may simplify the task of moving fast through the list to where the languages starting by a particular letter are with minimal movement (since scrolling of contents is vertical too).

The main problem now is that some languages are hidden in the "Suggested languages" list when there are a lot of them, but columns are not consistently populated.

Estremeñu below the line at [[en:Earth]]

irudia.png (535×1 px, 55 KB)

French below the line at [[:es:Japón]]

irudia.png (547×1 px, 85 KB)

Galician below the line at [[:es:Neutrino]]

irudia.png (600×1 px, 111 KB)

As this languages are different depending on the user location, results may vary for other viewers.

  • Sorting languages - Languages are ordered based on their script and label as specified but the ordering is done from left to right instead of top to bottom. I think this offers a more natural experience and reduces eye movement.

Going sideways is the natural way when reading contents. However, when scanning lists (such as an index in a book) vertical scanning can be more efficient. In this particular case, it may simplify the task of moving fast through the list to where the languages starting by a particular letter are with minimal movement (since scrolling of contents is vertical too).

A supporting argument for this is our category pages:

image.png (1×1 px, 529 KB)

To reduce complexity, would it be okay to adopt this layout? E.g. drop the chunking per viewport and require people to scroll up and down like they do on category pages if they need to continue scanning at the end of one column? I think this would also solve the issue for suggested languages, which would only take 1-3 rows evenly instead of filling the first column full and leaving others mostly empty?

Change #1237539 merged by jenkins-bot:

[mediawiki/core@master] useLanguageSelector: Expose isSearching state

https://gerrit.wikimedia.org/r/1237539

Test wiki created on Patch demo by APatro (WMF) using patch(es) linked to this task:
https://b1b9984c26.catalyst.wmcloud.org/w/

Change #1247961 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/UniversalLanguageSelector@master] ULS rewrite: Improve handling of selected language

https://gerrit.wikimedia.org/r/1247961

Change #1248774 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/UniversalLanguageSelector@master] ULS rewrite: Determine isMobile flag within component

https://gerrit.wikimedia.org/r/1248774

Change #1235324 merged by jenkins-bot:

[mediawiki/extensions/UniversalLanguageSelector@master] Add UniversalLanguageSelector Vue component

https://gerrit.wikimedia.org/r/1235324

Change #1247961 merged by jenkins-bot:

[mediawiki/extensions/UniversalLanguageSelector@master] ULS rewrite: Improve handling of selected language

https://gerrit.wikimedia.org/r/1247961

Change #1254149 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[operations/mediawiki-config@master] Enable ULS rewrite beta feature

https://gerrit.wikimedia.org/r/1254149

Change #1248774 merged by jenkins-bot:

[mediawiki/extensions/UniversalLanguageSelector@master] ULS rewrite: Determine isMobile flag within component

https://gerrit.wikimedia.org/r/1248774

Change #1254149 merged by jenkins-bot:

[operations/mediawiki-config@master] Enable ULS rewrite beta feature

https://gerrit.wikimedia.org/r/1254149

Mentioned in SAL (#wikimedia-operations) [2026-03-23T07:03:50Z] <kartik@deploy2002> Started scap sync-world: Backport for [[gerrit:1254149|Enable ULS rewrite beta feature (T418187 T253303)]]

Mentioned in SAL (#wikimedia-operations) [2026-03-23T07:22:50Z] <kartik@deploy2002> kartik, abi: Backport for [[gerrit:1254149|Enable ULS rewrite beta feature (T418187 T253303)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-03-23T07:45:20Z] <kartik@deploy2002> Finished scap sync-world: Backport for [[gerrit:1254149|Enable ULS rewrite beta feature (T418187 T253303)]] (duration: 41m 30s)

Test wiki on Patch demo by APatro (WMF) using patch(es) linked to this task was deleted:

https://b1b9984c26.catalyst.wmcloud.org/w/

Test wiki on Patch demo by APatro (WMF) using patch(es) linked to this task was deleted:

https://4746513a95.catalyst.wmcloud.org/w/

Nikerabbit removed a project: Patch-For-Review.
Nikerabbit moved this task from In Progress to Done on the LPL Essential (FY2025-26 Q3) board.