Page MenuHomePhabricator

Left-to-right usernames with punctuation displayed incorrectly on right-to-left wikis
Open, LowPublic


Author: rschnautz

My username is "Rob Schnautz (WMF)". However, a right-to-left display of my username at displays as "(Rob Schnautz (WMF". Not sure if this is something that can actually be fixed, but it sure is confusing!

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:09 AM
bzimport set Reference to bz35085.
bzimport created this task.Mar 9 2012, 3:47 PM

rschnautz wrote:

Templates surrounding the text seem like a logical solution, although with Unified Login, this still poses a problem in the menus.

This issue bothered me for a long time. It was so obvious that i didn't report it myself.

Usernames are displayed in a lot of places, so i should try to find a solution that displays them correctly everywhere, but since there are so many possibilities - signatures, LQT, logs and many others, one catch-all solution may be impossible and this bug may become a tracking bug for the different cases...

Wouldn't that be like trying to fix problems that are inherent to the bidi algorithm? Mixing scripts will always result in this, be it with usernames, page titles, ...

Of course, but you can always try to outsmart it.

Amir E. Aharoni: This issue has been assigned to you in March 2012.
Could you please provide a status update and inform us whether you are still working (or still plan to work) on this issue?
Only in case you do not plan to work on this issue anymore, should the assignee be set back to default and the bug status changed from ASSIGNED to NEW/UNCONFIRMED? Thanks.

Amire80 removed Amire80 as the assignee of this task.Jan 24 2015, 2:02 PM
Restricted Application added a project: I18n. · View Herald TranscriptJun 2 2015, 2:20 PM

For your templates or your signatures the simple fix is to enclose your username in a <bdi></bdi> element (you can do that on any user name in a template, it works even if they are using RTL or LTR scripts). This has the decired effect of isolating it so that it internally its direction won't depend of the direction of the outer context (as if it was a new paragraph) and externally the whole bdi element will be transparent, meaning that it won't reorder the context before or after it and will follow the normal flow in that outer context.
Support for bdi in browsers is now very common.

Previously "bidi isolation" was not possible in HTML and CSS that required bdi overrides only, using the dir attribute (even without using Unicode Bidi control characters, something that should anyway never be done, as these controls are ONLY for plain-text documents, you could also use CSS but the "bdo" element already is mapped to use this CSS style). But this method is deprecated because even if it allowed specifying the bidi ordering of the inner content, it was not transaprent and caused the text in the outer context to be reordered (notably characters with weak directions or that could be mirrored)

In other words: don't use Unicode bidi controls. Don't use CSS styles (they are mapped by default on the HTML elements), don't use dir="rtl/ltr", and don't use "bdo". Use bdi directly without any dir or style attribute. This can be done in all templates where there's a placeholder for a user name parameter. And for personal signatures in user preferences, insert it explicitly within a "bdi" element (you are not required to embed all your signature in it, because your signature may include other text such as a translated link to your talk page or some other description of your choice, in a language appropriate for the wiki and with another directionality then the one used for your user name.

All major browsers support now "bdi" elements (BiDi Isolate) in HTML on desktops and mobiles, this support is in fact within the CSS, not in the HTML DOM., browsers only have to have a default CSS style for this element, and they don't absolutely need to support Bidi controls within text elements.

Only old smartphone (or old devices with embedded browsers such as "smart TVs" using often very old and basic browsers such as Embedded Opera) may not understand this element, but this will not cause them troubles if they ignore this tag (they are anyway unable to render the correct expected order if they only support bdi overrides and not bidi isolation, which requires a newer implementation of the Bidi algorithm whose documentation has been updated by Unicode. This requires a change in the web rendererer (without its layout engine).

On desktops and major mobile OSes (iOS, Android and Windows Phone) we can assume that almost all of them will use updated browsers (IE, Safari, Chrome, Firefox. Opera).

Ebraminio moved this task from Backlog to MediaWiki-core on the RTL board.Aug 9 2015, 11:48 AM
Amire80 moved this task from Untriaged to RTL on the I18n board.Feb 28 2018, 12:12 PM