Advertisement:
2by2host

Author Topic: Birthday of users using an RTL name displays incorrectly  (Read 1852 times)

Offline Doctor Deejay

  • On Hiatus
  • SMF Hero
  • *
  • Posts: 3,491
  • Gender: Male
Birthday of users using an RTL name displays incorrectly
« on: May 06, 2012, 09:58:24 AM »
Appears on this forum, the user uses the English language pack, but the birthday displays right to left. Example is in the screenshot. :)
Doctor Deejay                                        I understand everything... except that wig. - Jack Sparrow
Simple Machines LocalizerDon't pm me for support
deejay [at] simplemachines [dot] orgGet To Know The Team - Dr. Deejay

Offline MrPhil

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 6,645
Re: Birthday of users using an RTL name displays incorrectly
« Reply #1 on: May 08, 2012, 02:33:02 PM »
OK, so the name is in some Arabic-family RTL script. Is the complaint that the age is to the left of the name (which would be reasonable for a RTL script name, although all others are LTR with age to the right), or that the closing parenthesis is facing the wrong way and is where it would be for a LTR entry? It looks like something is switching back to LTR either too early (leaving the closing parenthesis in the wrong place) or too late (placing the age to the left [later in sequence] of the name, rather than the right, as would be appropriate for English.

Does it behave this way on different browsers? Can you tell if the name includes RTL and LTR control codes, or is the browser figuring that out for itself? (or is SMF?) I don't have practical experience with RTL (bidirectional) scripts and languages, so I'll admit I'm just guessing here. UTF-8 encoding?
Please do not PM me with support questions, unless I ask you to. Unsolicited PMs for support will be ignored. It's best to have questions and answers in public, so others can research a problem and learn about it without having to ask the question yet again. Thank you!
FAQs | SMF 1.1 fixes | Project ideas
-= From the ashes shall rise a sooty tern =-

Offline emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,874
  • Gender: Male
  • Because Orange is Orange
Re: Birthday of users using an RTL name displays incorrectly
« Reply #2 on: May 12, 2012, 07:53:05 AM »
ehhh...tricky.

The only way I found to fix this is to replace:
Code: (find) [Select]
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<strong>' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '<br />' : ', ';with:
Code: (replace with) [Select]
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<strong style="display:inline-block">' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '<br />' : ', ';
That means add the style:
Code: [Select]
style="display:inline-block"to the <strong> tag.
inline-block seems to be supported by IE (at least w3schools.com doesn't say it's not supported... :P).

If we can use this trick I think it would be better to change a bit the markup..i (i.e. assign a class to the <p> tag and apply the style from index.css)

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,874
  • Gender: Male
  • Because Orange is Orange
Re: Birthday of users using an RTL name displays incorrectly
« Reply #3 on: June 17, 2012, 04:47:59 AM »
Commit: 9bd5f4266c8367c3260084d6a1e843b43e7ee2c5

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.