Page MenuHomePhabricator

Add a warning when a variant of the source language is selected
Closed, ResolvedPublic4 Estimated Story PointsFeature

Assigned To
Authored By
abi_
Sep 6 2022, 2:36 PM
Referenced Files
F35692416: Screen Shot 2022-11-01 at 21.41.38 PM.png
Nov 1 2022, 6:44 PM
F35638658: image.png
Oct 27 2022, 9:42 AM
F35596659: image.png
Oct 18 2022, 3:04 PM
F35596657: image.png
Oct 18 2022, 3:04 PM
F35596655: image.png
Oct 18 2022, 3:04 PM
F35562555: image.png
Oct 11 2022, 1:15 PM
F35562546: image.png
Oct 11 2022, 1:15 PM
F35534219: Screen Shot 2022-09-26 at 08.33.22 AM.png
Sep 26 2022, 5:39 AM

Description

Translating into a specific variant of the same language is a special kind of translation. So the warning may help users to pay attention to the target language they selected:

Warning when variants.png (848×1 px, 144 KB)


Variant detection logic:

  • If: target and source language are same, return false;
  • Else:
    • From the target language and source language, trim everything from and including the first hypen (-). Eg: en-ca would become en
    • Compare the two resultant string and if they are equal then return true, else return false.

We should also check if the translation to target language is disabled (wgTranslateDisabledTargetLanguages), if so variant detection need not be run at all..

Event Timeline

abi_ triaged this task as High priority.Sep 6 2022, 2:36 PM
abi_ created this task.
abi_ set the point value for this task to 4.
Nikerabbit lowered the priority of this task from High to Medium.Sep 7 2022, 11:06 AM

Change 830855 had a related patch set uploaded (by Wangombe; author: Wangombe):

[mediawiki/extensions/Translate@master] Add warning on variant source language selected

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

FYI here is a list of languages with variants in translatewiki.net. ! means the code is disabled as target language by configuration, * means these are minor variants were translations should only be saved if they are different from the source:

ady!
ady-cyrl

aeb!
aeb-arab
aeb-latn

ale
ale-cyrl

ban
ban-bali

bbc!
bbc-latn

be
be-tarask

cbk-zam

cja-latn
cjm-latn

cjy!
cjy-hans
cjy-hant

cnr-cyrl
cnr-latn

crh!
crh-cyrl
crh-latn

de
de-at*
de-ch*
de-formal*

en
en-ca*
en-gb*

es
es-419!
es-formal*

gan!
gan-hans
gan-hant

gom!
gom-deva
gom-latn

hak
hak-hans
hak-hant

hif!
hif-deva
hif-latn

hu
hu-formal*

ike-cans
ike-latn

jdt-cyrl

kbd!
kbd-cyrl
kbd-latn

kk!
kk-arab
kk-cn!
kk-cyrl
kk-kz!
kk-latn
kk-tr!

ko
ko-kp

ks!
ks-arab
ks-deva

ku!
ku-arab
ku-latn

lad
lad-hebr

mak
mak-bugi
map-bms

ms
ms-arab

mww-latn

nds
nds-nl

nl
nl-informal*

nod
nod-thai

pap
pap-aw

pt
pt-br

roa-tara(!)

ruq!
ruq-cyrl
ruq-grek
ruq-latn

se
se-fi!
se-no!
se-se!

shi
shi-latn
shi-tfng

shy
shy-latn

skr!
skr-arab

sr!
sr-ec
sr-el

tg!
tg-cyrl
tg-latn

tly
tly-cyrl

tt!
tt-cyrl
tt-latn

ug!
ug-arab
ug-latn

uz
uz-cyrl
uz-latn

zh!
zh-cn!
zh-hans
zh-hant
zh-hk
zh-mo!
zh-my!
zh-sg!
zh-tw!

Our current implementation might cause a couple of warnings to be displayed at the same time.

Eg: when translations to certain languages are not a priority but translators are not blocked from translating to them

image.png (718×1 px, 84 KB)

To me it looks OK overall, maybe just a bit busy. Thoughts?

What is the (unset) control for?
I think this looks pretty good. I do wonder if there are other cases (for warnings) that we would need to cover. Adding another warning for whatever reason, may render the page cluttered.

What is the (unset) control for?

That is to denote the current message group state. See: https://www.mediawiki.org/wiki/Help:Extension:Translate/Message_group_states

Our current implementation might cause a couple of warnings to be displayed at the same time.

Eg: when translations to certain languages are not a priority but translators are not blocked from translating to them

image.png (718×1 px, 84 KB)

To me it looks OK overall, maybe just a bit busy. Thoughts?

For this particular case, the "not a priority" message is already covering most of the intended goals for the other message (surface that "British english" was selected and discourage usage unless you really know what you are doing). For a user accidentally selecting British English, I'd expect that to be enough. So I'd be in favour of hiding the second message in this case.

For other warnings, we may want to keep both if they have less overlap in the messaging. Do we have a list of such messages?

If there are some combinations expected to be very common, we can consider also unifying them, showing a custom message that mentions both considerations in a more succinct way than showing separate messages one after the other.

For this particular case, the "not a priority" message is already covering most of the intended goals for the other message (surface that "British english" was selected and discourage usage unless you really know what you are doing).

I don’t think this is what this message means. I’d interpret it rather as “you should consider translating into French if you speak French, as it’s more important, but do go ahead and translate into the current language if that’s the only one you know”. With this interpretation, the second warning absolutely makes sense.


By the way, couldn’t we use the standard “warning” box instead of the current custom background color? It’s inconsistent with other parts of the interface.

By the way, couldn’t we use the standard “warning” box instead of the current custom background color? It’s inconsistent with other parts of the interface.

Screen Shot 2022-09-26 at 08.33.22 AM.png (345×1 px, 57 KB)

That's a good observation.

For this particular case, the "not a priority" message is already covering most of the intended goals for the other message (surface that "British english" was selected and discourage usage unless you really know what you are doing).

I don’t think this is what this message means. I’d interpret it rather as “you should consider translating into French if you speak French, as it’s more important, but do go ahead and translate into the current language if that’s the only one you know”. With this interpretation, the second warning absolutely makes sense.

You are right in your interpretation about what the message says. My point is that, thinking about the scenario where a user wants to translate to French but British English is selected instead, the user reading a message such as "Translating to British English is not a priority for this page" is likely to realize that the wrong language is selected (" am I translating into British English?") and select a the correct one after. This would be a side-effect of the message making it more visible which is the selected language.

I see what you mean. I’m not sure if you’re right, though – if it’s just the usual message about the non-priority language, one might simply mentally ignore it without reading it carefully because they know that they want to “do go ahead”. Showing two messages shows that something is really, really suspicious.

A note on patchset 27:

  1. The group workflow status and the warnings have no spacing in between. We can add a margin-bottom of 5px to tux-workflow to fix this.
  2. The gap below the warnings and the messages is quite high. I don't think we should let the margin-bottom for that be more than 5px as well.
  3. I'm not seeing the message table filters (All, Untranslated, Translated ...) at all in the patchset.

See image below:

image.png (586×1 px, 90 KB)

These are the current "gaps" without the changes:

image.png (405×1 px, 50 KB)

We've tweaked the margins around tux header area. Here are some screens:

image.png (618×1 px, 43 KB)


image.png (667×1 px, 64 KB)


image.png (582×1 px, 49 KB)

Change 830855 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Add warning when a variant of source language is selected

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

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

[mediawiki/extensions/Translate@master] Hide message api load errors before displaying them again

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

Change 844509 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Hide message api load errors before displaying them again

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

Nikerabbit changed the subtype of this task from "Task" to "Feature Request".Oct 27 2022, 8:32 AM

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

[mediawiki/extensions/Translate@master] Add "column" CSS class to div displaying group warnings

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

I'm noticing some issues with MW 1.38 and Timeless

image.png (366×1 px, 36 KB)

I've submitted a patch to fix this.

Change 850045 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Add "column" CSS class to div displaying group warnings

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