http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90743
Revision: 90743
Author: robin
Date: 2011-06-24 23:01:49 +0000 (Fri, 24 Jun 2011)
Log Message:
-----------
Directionality improvements as part of bug 6100 (under $wgBetterDirectionality):
* Add CSS that should fix all LTR/LTR text on both LTR/RTL wikis, for the
editsection link, TOC, and lists (ul/ol).
* Add a class mw-content-ltr/rtl for that.
* Change the divs on CategoryPage so it works wit that CSS.
This is the last relatively major issue for bug 6100.
Modified Paths:
--------------
trunk/phase3/includes/CategoryPage.php
trunk/phase3/includes/EditPage.php
trunk/phase3/includes/ImagePage.php
trunk/phase3/includes/SkinTemplate.php
trunk/phase3/skins/common/shared.css
Modified: trunk/phase3/includes/CategoryPage.php
===================================================================
--- trunk/phase3/includes/CategoryPage.php 2011-06-24 22:10:39 UTC (rev
90742)
+++ trunk/phase3/includes/CategoryPage.php 2011-06-24 23:01:49 UTC (rev
90743)
@@ -179,10 +179,13 @@
$r = wfMsgExt( 'category-empty', array( 'parse' ) );
}
- global $wgBetterDirectionality, $wgLang;
+ global $wgBetterDirectionality, $wgTitle;
if( $wgBetterDirectionality ) {
- $langAttribs = array( 'lang' => $wgLang->getCode(),
'dir' => $wgLang->getDir() );
- $r = Html::rawElement( 'div', $langAttribs, $r );
+ $pageLang = $wgTitle->getPageLanguage();
+ $langAttribs = array( 'lang' => $pageLang->getCode(),
'dir' => $pageLang->getDir() );
+ # close the previous div, show the headings in user
language,
+ # then open a new div with the page content language
again
+ $r = '</div>' . $r . Html::openElement( 'div',
$langAttribs );
}
wfProfileOut( __METHOD__ );
@@ -516,7 +519,8 @@
global $wgBetterDirectionality, $wgTitle;
if( $wgBetterDirectionality ) {
$pageLang = $wgTitle->getPageLanguage();
- $attribs = array( 'lang' => $pageLang->getCode(), 'dir'
=> $pageLang->getDir() );
+ $attribs = array( 'lang' => $pageLang->getCode(), 'dir'
=> $pageLang->getDir(),
+ 'class' => 'mw-content-'.$pageLang->getDir() );
$list = Html::rawElement( 'div', $attribs, $list );
}
Modified: trunk/phase3/includes/EditPage.php
===================================================================
--- trunk/phase3/includes/EditPage.php 2011-06-24 22:10:39 UTC (rev 90742)
+++ trunk/phase3/includes/EditPage.php 2011-06-24 23:01:49 UTC (rev 90743)
@@ -2098,7 +2098,8 @@
global $wgBetterDirectionality;
if( $wgBetterDirectionality ) {
$pageLang = $this->mTitle->getPageLanguage();
- $attribs = array( 'lang' => $pageLang->getCode(), 'dir'
=> $pageLang->getDir() );
+ $attribs = array( 'lang' => $pageLang->getCode(), 'dir'
=> $pageLang->getDir(),
+ 'class' => 'mw-content-'.$pageLang->getDir() );
$previewHTML = Html::rawElement( 'div', $attribs,
$previewHTML );
}
wfProfileOut( __METHOD__ );
Modified: trunk/phase3/includes/ImagePage.php
===================================================================
--- trunk/phase3/includes/ImagePage.php 2011-06-24 22:10:39 UTC (rev 90742)
+++ trunk/phase3/includes/ImagePage.php 2011-06-24 23:01:49 UTC (rev 90743)
@@ -117,7 +117,8 @@
# but this section (the actual wikitext) should be in
page content language
$pageLang = $this->mTitle->getPageLanguage();
$wgOut->addHTML( Xml::openElement( 'div', array( 'id'
=> 'mw-imagepage-content',
- 'lang' => $pageLang->getCode(), 'dir' =>
$pageLang->getDir() ) ) );
+ 'lang' => $pageLang->getCode(), 'dir' =>
$pageLang->getDir(),
+ 'class' => 'mw-content-'.$pageLang->getDir() )
) );
parent::view();
$wgOut->addHTML( Xml::closeElement( 'div' ) );
} else {
Modified: trunk/phase3/includes/SkinTemplate.php
===================================================================
--- trunk/phase3/includes/SkinTemplate.php 2011-06-24 22:10:39 UTC (rev
90742)
+++ trunk/phase3/includes/SkinTemplate.php 2011-06-24 23:01:49 UTC (rev
90743)
@@ -462,7 +462,8 @@
in_array( $action, array( 'view', 'render',
'print' ) ) &&
( $this->getTitle()->exists() ||
$this->getTitle()->getNamespace() == NS_MEDIAWIKI ) ) {
$pageLang =
$this->getTitle()->getPageLanguage();
- $realBodyAttribs = array( 'lang' =>
$pageLang->getCode(), 'dir' => $pageLang->getDir() );
+ $realBodyAttribs = array( 'lang' =>
$pageLang->getCode(), 'dir' => $pageLang->getDir(),
+ 'class' =>
'mw-content-'.$pageLang->getDir() );
$out->mBodytext = Html::rawElement( 'div',
$realBodyAttribs, $out->mBodytext );
}
}
Modified: trunk/phase3/skins/common/shared.css
===================================================================
--- trunk/phase3/skins/common/shared.css 2011-06-24 22:10:39 UTC (rev
90742)
+++ trunk/phase3/skins/common/shared.css 2011-06-24 23:01:49 UTC (rev
90743)
@@ -62,7 +62,9 @@
float: right;
margin-left: 5px;
}
-
+/* Correct directionality when page dir is different from site/user dir */
+/* @noflip */.mw-content-ltr .editsection, .mw-content-rtl [dir="ltr"]
.editsection { float: right; }
+/* @noflip */.mw-content-rtl .editsection, .mw-content-ltr [dir="rtl"]
.editsection { float: left; }
/**
* File histories
*/
@@ -614,6 +616,18 @@
background-repeat: no-repeat;
}
+/* Correct directionality when page dir is different from site/user dir */
+/* @noflip */.mw-content-ltr ul, .mw-content-ltr ol,
+.mw-content-rtl [dir="ltr"] ul, .mw-content-rtl [dir="ltr"] ol {
+ margin: .3em 0 0 1.5em;
+}
+/* @noflip */.mw-content-rtl ul, .mw-content-rtl ol,
+.mw-content-ltr [dir="rtl"] ul, .mw-content-ltr [dir="rtl"] ol {
+ margin: .3em 1.5em 0 0;
+}
+/* @noflip */ {
+ margin: .3em 1.5em 0 0;
+}
/* Localised ordered list numbering for some languages */
ol:lang(bcc) li,
ol:lang(bqi) li,
@@ -640,6 +654,26 @@
list-style-type: oriya;
}
+/* Correct directionality when page dir is different from site/user dir */
+/* @noflip */.mw-content-ltr .toc ul, .mw-content-ltr #toc ul,
+.mw-content-rtl [dir="ltr"] .toc ul, .mw-content-rtl [dir="ltr"] #toc ul {
+ text-align: left;
+ margin-left: 0;
+}
+/* @noflip */.mw-content-rtl .toc ul, .mw-content-rtl #toc ul,
+.mw-content-ltr [dir="rtl"] .toc ul, .mw-content-ltr [dir="rtl"] #toc ul {
+ text-align: right;
+ margin-right: 0;
+}
+/* @noflip */.mw-content-ltr .toc ul ul, .mw-content-ltr #toc ul ul,
+.mw-content-rtl [dir="ltr"] .toc ul ul, .mw-content-rtl [dir="ltr"] #toc ul ul
{
+ margin: 0 0 0 2em;
+}
+/* @noflip */.mw-content-rtl .toc ul ul, .mw-content-rtl #toc ul ul,
+.mw-content-ltr [dir="rtl"] .toc ul ul, .mw-content-ltr [dir="rtl"] #toc ul ul
{
+ margin: 0 2em 0 0;
+}
+
/* tooltip styles */
.mw-help-field-hint {
display: none;
@@ -737,3 +771,7 @@
direction: ltr !important;
unicode-bidi: embed;
}
+
+#mw-revision-info, #mw-revision-nav {
+ direction: ltr;
+}
\ No newline at end of file
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs