Page MenuHomePhabricator

When displaying a LTR fallback label in a RTL locale we should add the `dir` and `lang` attribute
Closed, ResolvedPublic

Description

In the example below the the degree sign is displayed in the wrong position.

CleanShot 2023-07-25 at 16.48.18@2x.png (1×3 px, 262 KB)

Adding the dir=ltr attribute fixes this issue.

CleanShot 2023-07-25 at 16.50.32@2x.png (240×2 px, 66 KB)

We should also add the lang attribute given that we know in which language the text is being displayed.

Event Timeline

Amire80 renamed this task from When displaying a LTR fallback label in a RLT locale we should add the `dir` and `lang` attribute to When displaying a LTR fallback label in a RTL locale we should add the `dir` and `lang` attribute.Jul 25 2023, 2:58 PM

another use case to keep in mind while working on this

CleanShot 2023-07-31 at 15.25.11@2x.png (816×756 px, 67 KB)

A bug-report in Telegram provided this example, which I believe is part of this task. Adding here in case live-examples are useful:
Screenshot from https://www.wikifunctions.org/wiki/Z11938?uselang=pnb versus https://www.wikifunctions.org/wiki/Z11938?uselang=en
where the text should display as +e Python but shows as e Python+ in RTL.

image.png (1×622 px, 334 KB)

Change #1032417 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] [WIP] Add dir and lang to HTML elements that differ from global uselang

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

Change #1032417 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Add dir and lang to HTML elements that differ from global uselang

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