1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Partial Fix Mixed usernames with RTL and LTR charecters

Discussion in 'Resolved Bug Reports' started by Moshe1010, Apr 13, 2014.

  1. Moshe1010

    Moshe1010 Well-Known Member

    When people "like" a post, and their username contains LTR and RTL characters/letters, it messes up the entire list of the users who liked that specific post.
    See here:
    http://img854.imageshack.us/img854/5692/h97.gif

    The mixed character user should give the "like" last out of the 3 in order to reproduce it.
     
    rellect likes this.
  2. rellect

    rellect Well-Known Member

    Adding `display:inline-block` for each username link should fix it.
     
  3. Mike

    Mike XenForo Developer Staff Member

    I'm tempted to say that things like this should be handled in the translation/phrases themselves -- the correct RLM would need to be inserted after the usernames (or comma, as that's the weak character). This does potentially come up in any "sentence" based structure (recent activity, etc).
     
  4. Moshe1010

    Moshe1010 Well-Known Member

    This is how the translation looks like:
    {user1}, {user2} ו-{user3} אוהבים את זה.

    {user1}
    Should be first as in RTL. There are no commas before a third (or last) item in Hebrew (in English it depends on the writing style, but in Hebrew it's totally incorrect).
     
  5. rellect

    rellect Well-Known Member

    Maybe a new string helper?
    Something like
    PHP:
    {xen:string rlm, {xen:phrase x_y_z}}
    Which will add ‏ after each comma.
     
  6. Mike

    Mike XenForo Developer Staff Member

    So after a load of research, the proper way to solve this involves the <bdi> tag, which has minimal support (no IE, AFAIK). The goal is to isolate the individual elements in terms of the bidi algorithm. (There's also a unicode-bidi CSS option, though it's not targeted at designers.)

    There's also a new direction="auto" attribute which may work (it uses the first strong character to detect the direction, which could possibly be incorrect but I suppose it's no worse than what we have right now. This might be the easiest thing to check as it doesn't change any markup (in the <xen:username /> case).

    There are potentially a lot of cases where this needs to be inserted though, I think.
     
    sami simo and Moshe1010 like this.

Share This Page