Index: trunk/phase3/skins/Standard.php |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | } |
103 | 103 | wfProfileOut( __METHOD__ . '-2' ); |
104 | 104 | wfProfileIn( __METHOD__ . '-3' ); |
105 | | - $l = $wgContLang->isRTL() ? 'right' : 'left'; |
| 105 | + $l = $wgContLang->alignStart(); |
106 | 106 | $s .= "<td class='bottom' align='$l' valign='top'>"; |
107 | 107 | |
108 | 108 | $s .= $this->bottomLinks(); |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -1292,7 +1292,7 @@ |
1293 | 1293 | if( !is_array( $target ) ) { |
1294 | 1294 | $target = array( $target ); |
1295 | 1295 | } |
1296 | | - $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; |
| 1296 | + $imageDir = $wgContLang->getDir(); |
1297 | 1297 | $imageUrl = $wgStylePath . '/common/images/redirect' . $imageDir . '.png'; |
1298 | 1298 | $imageUrl2 = $wgStylePath . '/common/images/nextredirect' . $imageDir . '.png'; |
1299 | 1299 | $alt2 = $wgContLang->isRTL() ? '←' : '→'; // should -> and <- be used instead of entities? |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -484,7 +484,7 @@ |
485 | 485 | # If thumbnail width has not been provided, it is set |
486 | 486 | # to the default user option as specified in Language*.php |
487 | 487 | if ( $fp['align'] == '' ) { |
488 | | - $fp['align'] = $wgContLang->isRTL() ? 'left' : 'right'; |
| 488 | + $fp['align'] = $wgContLang->alignEnd(); |
489 | 489 | } |
490 | 490 | return $prefix.$this->makeThumbLink2( $title, $file, $fp, $hp, $time, $query ).$postfix; |
491 | 491 | } |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1689,7 +1689,7 @@ |
1690 | 1690 | $this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() )); |
1691 | 1691 | } |
1692 | 1692 | |
1693 | | - $dir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; |
| 1693 | + $dir = $wgContLang->getDir(); |
1694 | 1694 | |
1695 | 1695 | if ( $wgHtml5 ) { |
1696 | 1696 | $ret .= "<!doctype html>\n"; |
— | — | @@ -1909,7 +1909,7 @@ |
1910 | 1910 | |
1911 | 1911 | if( isset( $options['dir'] ) ) { |
1912 | 1912 | global $wgContLang; |
1913 | | - $siteDir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; |
| 1913 | + $siteDir = $wgContLang->getDir(); |
1914 | 1914 | if( $siteDir != $options['dir'] ) |
1915 | 1915 | return ''; |
1916 | 1916 | } |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -276,7 +276,7 @@ |
277 | 277 | $tpl->setRef( 'serverurl', $wgServer ); |
278 | 278 | $tpl->setRef( 'logopath', $wgLogo ); |
279 | 279 | $tpl->setRef( 'lang', $wgContLanguageCode ); |
280 | | - $tpl->set( 'dir', $wgContLang->isRTL() ? 'rtl' : 'ltr' ); |
| 280 | + $tpl->set( 'dir', $wgContLang->getDir() ); |
281 | 281 | $tpl->set( 'rtl', $wgContLang->isRTL() ); |
282 | 282 | $tpl->set( 'capitalizeallnouns', $wgLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '' ); |
283 | 283 | $tpl->set( 'langname', $wgContLang->getLanguageName( $wgContLanguageCode ) ); |
Index: trunk/phase3/includes/specials/SpecialFileDuplicateSearch.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | ); |
101 | 101 | |
102 | 102 | if( $hash != '' ) { |
103 | | - $align = $wgContLang->isRtl() ? 'left' : 'right'; |
| 103 | + $align = $wgContLang->alignEnd(); |
104 | 104 | |
105 | 105 | # Show a thumbnail of the file |
106 | 106 | $img = wfFindFile( $title ); |
Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -330,14 +330,11 @@ |
331 | 331 | global $wgUser, $wgContLang; |
332 | 332 | // Check for uppercase extension. We allow these filenames but check if an image |
333 | 333 | // with lowercase extension exists already |
334 | | - $warning = ''; |
335 | | - $align = $wgContLang->isRtl() ? 'left' : 'right'; |
336 | | - |
337 | 334 | if( $exists === false ) |
338 | 335 | return ''; |
339 | 336 | |
340 | 337 | $warning = ''; |
341 | | - $align = $wgContLang->isRtl() ? 'left' : 'right'; |
| 338 | + $align = $wgContLang->alignEnd(); |
342 | 339 | |
343 | 340 | list( $existsType, $file ) = $exists; |
344 | 341 | |
Index: trunk/phase3/includes/specials/SpecialVersion.php |
— | — | @@ -33,11 +33,8 @@ |
34 | 34 | $this->setHeaders(); |
35 | 35 | $this->outputHeader(); |
36 | 36 | |
37 | | - if( $wgContLang->isRTL() ) { |
38 | | - $wgOut->addHTML( '<div dir="rtl">' ); |
39 | | - } else { |
40 | | - $wgOut->addHTML( '<div dir="ltr">' ); |
41 | | - } |
| 37 | + $wgOut->addHTML( Xml::openElement( 'div', |
| 38 | + array( 'dir' => $wgContLang->getDir() ) ) ); |
42 | 39 | $text = |
43 | 40 | $this->MediaWikiCredits() . |
44 | 41 | $this->softwareInformation() . |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -711,7 +711,7 @@ |
712 | 712 | $a['onload'] = $wgOut->getOnloadHandler(); |
713 | 713 | $a['class'] = |
714 | 714 | 'mediawiki' . |
715 | | - ' '.( $wgContLang->isRTL() ? 'rtl' : 'ltr' ). |
| 715 | + ' '.( $wgContLang->getDir() ). |
716 | 716 | ' '.$this->getPageClasses( $this->mTitle ) . |
717 | 717 | ' skin-'. Sanitizer::escapeClass( $this->getSkinName() ); |
718 | 718 | return $a; |
— | — | @@ -775,13 +775,13 @@ |
776 | 776 | } elseif( $left ) { |
777 | 777 | $s .= $this->getQuickbarCompensator( $rows ); |
778 | 778 | } |
779 | | - $l = $wgContLang->isRTL() ? 'right' : 'left'; |
| 779 | + $l = $wgContLang->alignStart(); |
780 | 780 | $s .= "<td {$borderhack} align='$l' valign='top'>\n"; |
781 | 781 | |
782 | 782 | $s .= $this->topLinks(); |
783 | 783 | $s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n"; |
784 | 784 | |
785 | | - $r = $wgContLang->isRTL() ? 'left' : 'right'; |
| 785 | + $r = $wgContLang->alignEnd(); |
786 | 786 | $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>"; |
787 | 787 | $s .= $this->nameAndLogin(); |
788 | 788 | $s .= "\n<br />" . $this->searchForm() . "</td>"; |
— | — | @@ -819,7 +819,7 @@ |
820 | 820 | |
821 | 821 | // Use Unicode bidi embedding override characters, |
822 | 822 | // to make sure links don't smash each other up in ugly ways. |
823 | | - $dir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; |
| 823 | + $dir = $wgContLang->getDir(); |
824 | 824 | $embed = "<span dir='$dir'>"; |
825 | 825 | $pop = '</span>'; |
826 | 826 | |
Index: trunk/phase3/includes/Pager.php |
— | — | @@ -837,17 +837,22 @@ |
838 | 838 | 'last' => 'table_pager_last', |
839 | 839 | ); |
840 | 840 | $images = array( |
841 | | - 'first' => $wgContLang->isRTL() ? 'arrow_last_25.png' : 'arrow_first_25.png', |
842 | | - 'prev' => $wgContLang->isRTL() ? 'arrow_right_25.png' : 'arrow_left_25.png', |
843 | | - 'next' => $wgContLang->isRTL() ? 'arrow_left_25.png' : 'arrow_right_25.png', |
844 | | - 'last' => $wgContLang->isRTL() ? 'arrow_first_25.png' : 'arrow_last_25.png', |
| 841 | + 'first' => 'arrow_first_25.png', |
| 842 | + 'prev' => 'arrow_left_25.png', |
| 843 | + 'next' => 'arrow_right_25.png', |
| 844 | + 'last' => 'arrow_last_25.png', |
845 | 845 | ); |
846 | 846 | $disabledImages = array( |
847 | | - 'first' => $wgContLang->isRTL() ? 'arrow_disabled_last_25.png' : 'arrow_disabled_first_25.png', |
848 | | - 'prev' => $wgContLang->isRTL() ? 'arrow_disabled_right_25.png' : 'arrow_disabled_left_25.png', |
849 | | - 'next' => $wgContLang->isRTL() ? 'arrow_disabled_left_25.png' : 'arrow_disabled_right_25.png', |
850 | | - 'last' => $wgContLang->isRTL() ? 'arrow_disabled_first_25.png' : 'arrow_disabled_last_25.png', |
| 847 | + 'first' => 'arrow_disabled_first_25.png', |
| 848 | + 'prev' => 'arrow_disabled_left_25.png', |
| 849 | + 'next' => 'arrow_disabled_right_25.png', |
| 850 | + 'last' => 'arrow_disabled_last_25.png', |
851 | 851 | ); |
| 852 | + if( $wgContLang->isRTL() ) { |
| 853 | + $keys = array_keys( $labels ); |
| 854 | + $images = array_combine( $keys, array_reverse( $images ) ); |
| 855 | + $disabledImages = array_combine( $keys, array_reverse( $disabledImages ) ); |
| 856 | + } |
852 | 857 | |
853 | 858 | $linkTexts = array(); |
854 | 859 | $disabledTexts = array(); |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -1863,6 +1863,38 @@ |
1864 | 1864 | function isRTL() { |
1865 | 1865 | return self::$dataCache->getItem( $this->mCode, 'rtl' ); |
1866 | 1866 | } |
| 1867 | + |
| 1868 | + /** |
| 1869 | + * Return the correct HTML 'dir' attribute value for this language. |
| 1870 | + * @return String |
| 1871 | + */ |
| 1872 | + function getDir() { |
| 1873 | + return $this->isRTL() ? 'rtl' : 'ltr'; |
| 1874 | + } |
| 1875 | + |
| 1876 | + /** |
| 1877 | + * Return 'left' or 'right' as appropriate alignment for line-start |
| 1878 | + * for this language's text direction. |
| 1879 | + * |
| 1880 | + * Should be equivalent to CSS3 'start' text-align value.... |
| 1881 | + * |
| 1882 | + * @return String |
| 1883 | + */ |
| 1884 | + function alignStart() { |
| 1885 | + return $this->isRTL() ? 'right' : 'left'; |
| 1886 | + } |
| 1887 | + |
| 1888 | + /** |
| 1889 | + * Return 'right' or 'left' as appropriate alignment for line-end |
| 1890 | + * for this language's text direction. |
| 1891 | + * |
| 1892 | + * Should be equivalent to CSS3 'end' text-align value.... |
| 1893 | + * |
| 1894 | + * @return String |
| 1895 | + */ |
| 1896 | + function alignEnd() { |
| 1897 | + return $this->isRTL() ? 'left' : 'right'; |
| 1898 | + } |
1867 | 1899 | |
1868 | 1900 | /** |
1869 | 1901 | * A hidden direction mark (LRM or RLM), depending on the language direction |