jenkins-bot has submitted this change and it was merged. Change subject: RTL fixes for Special:Magic ......................................................................
RTL fixes for Special:Magic Change-Id: I732461c5eff32d94b85f114ee84e80fea3ca9833 --- M ffs/MediaWikiComplexMessages.php 1 file changed, 18 insertions(+), 5 deletions(-) Approvals: Siebrand: Looks good to me, approved jenkins-bot: Verified diff --git a/ffs/MediaWikiComplexMessages.php b/ffs/MediaWikiComplexMessages.php index 718fd02..e157889 100644 --- a/ffs/MediaWikiComplexMessages.php +++ b/ffs/MediaWikiComplexMessages.php @@ -20,6 +20,7 @@ const LANG_CURRENT = 2; protected $language = null; + protected $targetDir = null; protected $id = '__BUG__'; protected $variable = '__BUG__'; protected $data = array(); @@ -37,8 +38,11 @@ 'style' => 'background-color: #F9F9F9; border: 1px #AAAAAA solid; border-collapse: collapse;', ); - public function __construct( $language ) { - $this->language = $language; + public function __construct( $langCode ) { + $this->language = $langCode; + + $language = Language::factory( $langCode ); + $this->targetDir = $language->getDir(); } public function getTitle() { @@ -273,14 +277,20 @@ } $value = array_map( 'htmlspecialchars', $value ); - $rowContents .= '<td>' . $this->formatElement( $value ) . '</td>'; + // Force ltr direction. The source is pretty much guaranteed to be English-based. + $rowContents .= '<td dir="ltr">' . $this->formatElement( $value ) . '</td>'; $value = $this->val( $group, self::LANG_CHAIN, $key ); if ( $this->firstMagic ) { array_shift( $value ); } - $value = array_map( 'htmlspecialchars', $value ); + // Apply bidi-isolation to each value. + // The values can both RTL and LTR and mixing them in a comma list + // can mix things up. + foreach ( $value as &$currentTranslation ) { + $currentTranslation = Xml::element( 'bdi', null, $currentTranslation ); + } $value = $this->highlight( $key, $value ); $rowContents .= '<td>' . $this->formatElement( $value ) . '</td>'; @@ -328,7 +338,10 @@ } public function editElement( $key, $contents ) { - return Xml::input( $this->getKeyForEdit( $key ), 40, $contents ); + return Xml::input( $this->getKeyForEdit( $key ), 40, $contents, array( + 'lang' => $this->language, + 'dir' => $this->targetDir, + ) ); } # -- To view, visit https://gerrit.wikimedia.org/r/57102 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I732461c5eff32d94b85f114ee84e80fea3ca9833 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il> Gerrit-Reviewer: Siebrand <siebr...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits