Page MenuHomePhabricator

Add image - image inspector flips filenames for RTL
Closed, ResolvedPublic

Description

Steps to reproduce
  1. On arwiki go to an article with add image suggestion.
  2. The image inspector will show the suggested image file name as RTL even though a filename is in LTR language.
Actual

e.g. the following file name File:Hubble Deep Field South full mosaic.jpg will be displayed flipped by the image inspector:

Screen Shot 2021-12-01 at 7.11.44 PM.png (1×818 px, 271 KB)

Expected

When the image details link is clicked - the file name displayed correctly:

Screen Shot 2021-12-01 at 7.13.08 PM.png (1×836 px, 283 KB)

Basically, the start of the filename and description should be displayed in the image inspector. When filename is in a LTR language (like English) on a RTL language wiki, it should also be displayed left-aligned.

Event Timeline

When the language of the description and the filename are in LTR language, I think the entire block should be left aligned (both in the inspector and in the image details dialog).

I'm not totally sure what to do for these instances though, where the label is in RTL and the content is LTR.

Screen Shot 2021-12-02 at 8.22.15 AM.png (446×474 px, 166 KB)

I'll let @RHo confirm.

tagging @Prtksxna due to his recent work on similar issues

tagging @Prtksxna due to his recent work on similar issues

Thanks @MRaishWMF! I think @Mooeypoo would be the best person to ask about mixed RTL/LTR content.

Looking at wikidata in ar as an example, I would have English and other LTR language content display left-aligned. IOW, I agree with @Etonkovidova's filing of this task in that the start of the filename and description should be displayed in the image inspector.

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

Ah, localizing filenames on wiki, yes. One of the toughy questions, honestly.

There's a lot of issues when you try and figure out how filenames should be displayed when they're RTL/LTR. Notable, some of them are dependent on --

  • the file suffixes (.jpg / .png etc) are always latin
  • but the NAME of the file could be any language or a mix of languages
  • The "File:" prefix is a namespace, which is localized/aliased. <-- I think this is likely the culprit of *this* specific bug.

However, there's also (it seems like?) a clear RLT-fixed alignment in the second screenshot; if the file in that situation was ALL-ENGLISH then it would've also been presented the same way as the previous screenshot (self-align itself to be LTR) but since the context of that second screenshot is RTL, and the namespace is translated (meaning the 'filename' is mixed, and STARTS with RTL) the alignment is slightly different.

I can't even tell you which one is "correct", because it depends on the context. Also, once we figure out which one is "correct" this isn't the only place it's "acting up" in.

In this case, I'd try to check why there's no consistency -- whichever consistent state you'd pick (likely the translated namespace one, I imagine?) and I'd try to make sure both endpoints at least present the same state (translated or not) so they both render the same.

I am speaking a bit blindly here since I didn't have the chance to fully examine the components or code, but I wanted to make a point here about the inconsistencies - in general - of filenames on commons, especially when dealing with translated namespaces.

Change 785949 had a related patch set uploaded (by MewOphaswongse; author: MewOphaswongse):

[mediawiki/extensions/GrowthExperiments@master] Add an image: use dir=auto for image description

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

Image inspector UI wIth patch:

en descriptionar description
Desktop
Screen Shot 2022-04-25 at 2.57.50 PM.png (630×970 px, 197 KB)
Screen Shot 2022-04-25 at 2.58.23 PM.png (634×976 px, 193 KB)
Mobile
Screen Shot 2022-04-25 at 3.00.35 PM.png (648×754 px, 177 KB)
Screen Shot 2022-04-25 at 3.01.29 PM.png (646×750 px, 178 KB)

Change 785949 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Add an image: use dir=auto for image description

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

Checked in betalabs (the last patch did not make to production yes). Checked on cswiki betalabs with UI lang interface set to Arabic.
In general, many files look good, e.g.

  • the LTR filename is not flipped
  • the fields with LTR content are displayed corectly

Screen Shot 2022-04-28 at 3.04.44 PM.png (1×1 px, 179 KB)


When a file name starts with a number, the image details cards moves those numbers to the end of file name field. Should we accommodate the cases?

File:6-00 PM Energy Meeting (11-2-77) - NARA - 142151.tif

Screen Shot 2022-04-28 at 2.52.31 PM.png (580×986 px, 114 KB)
Screen Shot 2022-04-28 at 2.54.55 PM.png (812×1 px, 149 KB)
  • "Used in the same article in 3 other languages" displayed correctly, but the dot (the punctuation mark) is placed in front of the sentence.
  • The beginning of the file name 6-00 is displayed correctly for the image card, but gets misplaced in the image details card.

Another example - a file name starts with a number displays the same problem File:319 Contracting Sq emblem.png

Screen Shot 2022-04-28 at 3.13.00 PM.png (1×1 px, 260 KB)

Thanks @Etonkovidova!

It looks like there are two separate issues here:

  1. In the image details dialog, number in LTR filename gets moved the the end.

I'll post another patch for this so that the image details dialog shows the LTR filename in full but right aligned (since the field label is RTL)

Screen Shot 2022-04-28 at 4.10.01 PM.png (58×526 px, 12 KB)

  1. ".Used in the same article in 3 other languages" shown

I think the translation might have been cached (since it's cswiki, the default should have been in cs so I'm guessing this is from switching from en to ar). This message should be shown in the UI language.

Screen Shot 2022-04-28 at 4.11.26 PM.png (630×974 px, 192 KB)

Thanks @Etonkovidova!

It looks like there are two separate issues here:

  1. In the image details dialog, number in LTR filename gets moved the the end.

I'll post another patch for this so that the image details dialog shows the LTR filename in full but right aligned (since the field label is RTL)

Screen Shot 2022-04-28 at 4.10.01 PM.png (58×526 px, 12 KB)

Thx!

  1. ".Used in the same article in 3 other languages" shown

I think the translation might have been cached (since it's cswiki, the default should have been in cs so I'm guessing this is from switching from en to ar). This message should be shown in the UI language.

Screen Shot 2022-04-28 at 4.11.26 PM.png (630×974 px, 192 KB)

Agree. Will check additionally for the translation (there is one more point that I'd like to check).

Change 787569 had a related patch set uploaded (by MewOphaswongse; author: MewOphaswongse):

[mediawiki/extensions/GrowthExperiments@master] Add an image: use dir=auto for field values in AddImageDetailsDialog

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

Image details dialog w/latest changes:

Screen Shot 2022-04-28 at 4.19.23 PM.png (690×1 px, 111 KB)

Change 787569 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Add an image: use dir=auto for field values in AddImageDetailsDialog

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

Checked on arwiki wmf.10- works as expected.

Screen Shot 2022-05-05 at 4.01.28 PM.png (696×540 px, 117 KB)
Screen Shot 2022-05-05 at 3.57.04 PM.png (731×530 px, 80 KB)
Screen Shot 2022-05-05 at 3.55.59 PM.png (826×1 px, 171 KB)