r102105 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102104‎ | r102105 | r102106 >
Date:16:50, 5 November 2011
Author:amire80
Status:resolved (Comments)
Tags:
Comment:
Adding dir="ltr" to the label, to prevent wrong appearance of the arithmetic expression.
Modified paths:
  • /trunk/extensions/ConfirmEdit/Captcha.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmEdit/Captcha.php
@@ -253,7 +253,9 @@
254254 $captcha = $this->getCaptcha();
255255 $index = $this->storeCaptcha( $captcha );
256256
257 - return "<p><label for=\"wpCaptchaWord\">{$captcha['question']}</label> = " .
 257+ // dir="ltr" is needed because otherwise it may say
 258+ // "5 - 20" instead of "20 - 5" and that would be wrong.
 259+ return "<p><label dir="ltr" for=\"wpCaptchaWord\">{$captcha['question']}</label> = " .
258260 Xml::element( 'input', array(
259261 'name' => 'wpCaptchaWord',
260262 'id' => 'wpCaptchaWord',

Follow-up revisions

RevisionCommit summaryAuthorDate
r102106FU r102105, escaped the quotes.amire8016:54, 5 November 2011
r105551Followup to r102105. Removed dir="ltr" from the math expression so as not to ...amire8014:22, 8 December 2011

Comments

#Comment by Santhosh.thottingal (talk | contribs)   05:24, 14 November 2011

I read that Maths formulas may be written in right to left in arabic, but Hebrew prefers always left to right. There is a mention about this difference in the new BIDI handling specification for structured text(http://cldr.unicode.org/development/development-process/design-proposals/bidi-handling-of-structured-text).

So forcing direction as ltr may not be correct solution, But what if we change, line 35 of MathCaptcha.class.php from

$sum = "{$a} {$op} {$b} = "; to $sum = "{$a}{$op}{$b} = ";

and leave directionality to browsers?

#Comment by Amire80 (talk | contribs)   19:36, 5 December 2011

This was actually discussed in the Standards Institute of Israel (SII) once, in my presence, and the decision was that it is always left-to-right - but that only applied to Hebrew. The Arabic textbooks i saw had left-to-right math expressions, but i obviously didn't see them all. I emailed the relevant SII discussion list and asked whether anybody knows any details about Arabic.

AFAIK if we remove the space, it will display the expression left-to-right even if dir="rtl" will be applied to it, because of the '-' character properties. I don't think that any locales override that, but i might be wrong. So the display will be left-to-right anyway, but the readability may be reduced - "10-8" vs. "10 - 8".

#Comment by Amire80 (talk | contribs)   14:26, 8 December 2011

I removed the ltr and the spaces around the operator in 105551.

Status & tagging log