Page MenuHomePhabricator

Language filters use 'All' as language code
Closed, ResolvedPublic

Authored By
santhosh
Dec 15 2017, 5:06 AM
Referenced Files
F12198092: Screen Shot 2018-01-01 at 7.07.49 PM.png
Jan 2 2018, 3:28 AM
F11914226: he-en-to-all.PNG
Dec 18 2017, 3:47 PM
F11914267: suggestions-sr-to-he.PNG
Dec 18 2017, 3:47 PM
F11853895: language-code-label.PNG
Dec 16 2017, 1:47 AM
F11853893: autonym-label.PNG
Dec 16 2017, 1:47 AM
F11838270: image.png
Dec 15 2017, 5:06 AM
F11838197: image.png
Dec 15 2017, 5:06 AM
Tokens
"Like" token, awarded by RandomDSdevel.

Description

image.png (303×725 px, 22 KB)

Changes to

image.png (320×677 px, 17 KB)

Note the change "All" to "all"

Also, at this point the html for the filter is

<div class="cx-language-filter-button" dir="ltr" lang="All">all</div>

The reason for this is, unconditional usage of language code without checking if it is "All" in mw.cx.ui.LanguageFilter.prototype.setFilterLabel

mw.language.bcp47('All')
> "all"

Event Timeline

Change 398610 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Use uppercase "All" language code on smaller screens

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

Alright, I have submitted a patch that doesn't make "All" pseudo language code go through bcp47, effectively making it stay uppercase.
Here is a comparison on how it looks with autonym language names vs language codes when screen gets smaller. I find that using uppercase only for "All" makes it look unbalanced.

Autonym namesLanguage codes
autonym-label.PNG (59×171 px, 1 KB)
language-code-label.PNG (56×125 px, 941 B)

@Pginer-WMF, any thoughts on this?

I find that using uppercase only for "All" makes it look unbalanced

Note that the label "All" will be translated to other languages where sometimes there is no upper case and lower case.

Note that the label "All" will be translated to other languages where sometimes there is no upper case and lower case.

The reason why previous message "From/To any language" was changed to "All" is to save space on smaller screens - T175010. And we aren't doing it right with the current approach. Localized messages can be much longer than three characters. And English version has two L letters (which are slim), making the whole text fit on really small devices.

Since we use language codes in Latin script on smaller screens anyway (shown in screenshot below), I think we should go with all pseudo language code on small screens for this special case, and keep the localized message on larger screens.

The problem with generated HTML (example in ticket description) should be fixed, of course.

Here are screenshots from CX with Hebrew as UI language:

English to AllAll language codes use Latin script
he-en-to-all.PNG (57×543 px, 2 KB)
suggestions-sr-to-he.PNG (46×538 px, 1 KB)

I don't think we should expose users with an artificial language code to represents all languages. Using the translated version of the word "all" seems more intuitive. That is, in Greek it will display "Όλα", and in Baque it will be "Guztiak". We can do this in both small and larger screens. For small screens it is ok if the text gets cropped with ellipsis if it becomes too long, but checking the translations that seems to be the exception.

Note that the label "All" will be translated to other languages where sometimes there is no upper case and lower case.

The reason why previous message "From/To any language" was changed to "All" is to save space on smaller screens - T175010. And we aren't doing it right with the current approach. Localized messages can be much longer than three characters. And English version has two L letters (which are slim), making the whole text fit on really small devices.

The longest I could find is six, but it's already a bit of a problem. For example, in Chechen, where "Ерриге" is shortened to "Ерр...".

Since we use language codes in Latin script on smaller screens anyway (shown in screenshot below), I think we should go with all pseudo language code on small screens for this special case, and keep the localized message on larger screens.

... Despite the length problem, if there's no choice, it's better to show a word with ellipsis than to show an English word. A shorter translated word is more likely to be understood than an English word.

For small screens it is ok if the text gets cropped with ellipsis if it becomes too long, but checking the translations that seems to be the exception.

It is actually this message.

Thank you @Amire80 and @Pginer-WMF for your inputs and for taking my suggestion into consideration. It is already working as described, with the submitted patch set to deal with HTML problems reported in the description of this ticket. We may only need to optimize for longer localized messages.

Change 398610 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Don't use directionality and autonym with "All" language code

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

Checked in cx-testing - 'All' does not change to lower case and the longer translation for all looks satisfactory:

Screen Shot 2018-01-01 at 7.07.49 PM.png (401×460 px, 57 KB)