* (bug 6126) Allow fallback to customized primary language when user language
message contains '-'; fixes licenses selector on Commons configuration after
recent addition of the message to Messages.php
-
+* (bug 6100) BiDi: different directionality for user interface and wiki content
== Compatibility ==
* the given title.
*/
function view() {
- global $wgUser, $wgOut, $wgRequest, $wgContLang;
+ global $wgUser, $wgOut, $wgRequest, $wgLang;
global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser;
global $wgUseTrackbacks;
$sk = $wgUser->getSkin();
$wgOut->addHTML( '<pre>'.htmlspecialchars($this->mContent)."\n</pre>" );
} else if ( $rt = Title::newFromRedirect( $text ) ) {
# Display redirect
- $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr';
+ $imageDir = $wgLang->isRTL() ? 'rtl' : 'ltr';
$imageUrl = $wgStylePath.'/common/images/redirect' . $imageDir . '.png';
# Don't overwrite the subtitle if this was an old revision
if( !$wasRedirected && $this->isCurrent() ) {
$wgOut->addParserOutputNoText( $parserOutput );
wfProfileOut( $fname );
- return $previewhead . $previewHTML;
+ return $previewhead .
+ '<div id="realContent"' . contentdir() . '>' .
+ $previewHTML .
+ '</div><!-- realContent -->';
}
}
return $items;
}
+/** @todo document */
+/* returns a dir="rtl" or dir="ltr" for the layout (eg: uselang) */
+function layoutdir() {
+ global $wgLang, $wgLanguageCode, $wgContLang, $wgContLanguageCode;
+ $lang = "";
+ $dir = "";
+ if ( $wgLanguageCode != $wgContLanguageCode ) {
+ $lang = " lang='$wgLanguageCode'";
+ }
+ if ( $wgLang->isRTL() != $wgContLang->isRTL() ) {
+ $dir = $wgLang->isRTL() ? " dir='rtl'" : " dir='ltr'";
+ }
+ return $lang . $dir;
+}
+
+/** @todo document */
+/* returns a dir="rtl" or dir="ltr" for the content (wiki lang) */
+function contentdir() {
+ global $wgLang, $wgLanguageCode, $wgContLang, $wgContLanguageCode;
+ $lang = "";
+ $dir = "";
+ if ( $wgLanguageCode != $wgContLanguageCode ) {
+ $lang = " lang='$wgContLanguageCode'";
+ }
+ if ( $wgLang->isRTL() != $wgContLang->isRTL() ) {
+ $dir = $wgContLang->isRTL() ? " dir='rtl'" : " dir='ltr'";
+ }
+ return $lang . $dir;
+}
+
class ReplacerCallback {
function ReplacerCallback( $from, $to ) {
$this->from = $from;
$text = $parserOutput->getText();
wfRunHooks( 'OutputPageBeforeHTML',array( &$this, &$text ) );
$parserOutput->setText( $text );
+ $this->addHTML( '<div id="realContent"' . contentdir() . '>');
$this->addHTML( $parserOutput->getText() );
+ $this->addHTML( '</div><!-- realContent -->');
}
/**
$this->mNewSectionLink = $parserOutput->getNewSection();
$text = $parserOutput->getText();
wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
+ $this->addHTML( '<div id="realContent"' . contentdir() . '>');
$this->addHTML( $text );
+ $this->addHTML( '</div><!-- realContent -->');
$t = $parserOutput->getTitleText();
if( !empty( $t ) ) {
$this->setPageTitle( $t );
function headElement() {
global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
global $wgUser, $wgContLang, $wgUseTrackbacks, $wgTitle;
+ global $wgLang, $wgLanguageCode;
if( $wgMimeType == 'text/xml' || $wgMimeType == 'application/xhtml+xml' || $wgMimeType == 'application/xml' ) {
$ret = "<?xml version=\"1.0\" encoding=\"$wgOutputEncoding\" ?>\n";
$this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ));
}
- $rtl = $wgContLang->isRTL() ? " dir='RTL'" : '';
- $ret .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"$wgContLanguageCode\" lang=\"$wgContLanguageCode\" $rtl>\n";
+ $rtl = $wgLang->isRTL() ? " dir='RTL'" : '';
+ $ret .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"$wgLanguageCode\" lang=\"$wgLanguageCode\" $rtl>\n";
$ret .= "<head>\n<title>" . htmlspecialchars( $this->getHTMLTitle() ) . "</title>\n";
array_push( $this->mMetatags, array( "http:Content-type", "$wgMimeType; charset={$wgOutputEncoding}" ) );
# get the user/site-specific stylesheet, SkinTemplate loads via RawPage.php (settings are cached that way)
function getUserStylesheet() {
- global $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage;
+ global $wgStylePath, $wgRequest, $wgLang, $wgContLang, $wgSquidMaxage;
$sheet = $this->getStylesheet();
$action = $wgRequest->getText('action');
$s = "@import \"$wgStylePath/$sheet\";\n";
- if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n";
+ if($wgLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n";
+ if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_content_rtl.css\";\n";
$query = "action=raw&ctype=text/css&smaxage=$wgSquidMaxage";
$s .= '@import "' . $this->makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) . "\";\n" .
}
function doBeforeContent() {
- global $wgContLang;
+ global $wgLang;
$fname = 'Skin::doBeforeContent';
wfProfileIn( $fname );
$shove = ($qb != 0);
$left = ($qb == 1 || $qb == 3);
- if($wgContLang->isRTL()) $left = !$left;
+ if($wgLang->isRTL()) $left = !$left;
if ( !$shove ) {
$s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
} elseif( $left ) {
$s .= $this->getQuickbarCompensator( $rows );
}
- $l = $wgContLang->isRTL() ? 'right' : 'left';
+ $l = $wgLang->isRTL() ? 'right' : 'left';
$s .= "<td {$borderhack} align='$l' valign='top'>\n";
$s .= $this->topLinks() ;
$s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n";
- $r = $wgContLang->isRTL() ? "left" : "right";
+ $r = $wgLang->isRTL() ? "left" : "right";
$s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
$s .= $this->nameAndLogin();
$s .= "\n<br />" . $this->searchForm() . "</td>";
if ( '' != $align ) { $a = " align='{$align}'"; }
else { $a = ''; }
- $mp = wfMsg( 'mainpage' );
+ $mp = wfMsgForContent( 'mainpage' );
$titleObj = Title::newFromText( $mp );
if ( is_object( $titleObj ) ) {
$url = $titleObj->escapeLocalURL();
}
function otherLanguages() {
- global $wgOut, $wgContLang, $wgHideInterlanguageLinks;
+ global $wgOut, $wgLang, $wgHideInterlanguageLinks;
if ( $wgHideInterlanguageLinks ) {
return '';
$s = wfMsg( 'otherlanguages' ) . ': ';
$first = true;
- if($wgContLang->isRTL()) $s .= '<span dir="LTR">';
+ if($wgLang->isRTL()) $s .= '<span dir="LTR">';
foreach( $a as $l ) {
if ( ! $first ) { $s .= ' | '; }
$first = false;
$nt = Title::newFromText( $l );
$url = $nt->escapeFullURL();
- $text = $wgContLang->getLanguageName( $nt->getInterwiki() );
+ $text = $wgLang->getLanguageName( $nt->getInterwiki() );
if ( '' == $text ) { $text = $l; }
$style = $this->getExternalLinkAttributes( $l, $text );
$s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
}
- if($wgContLang->isRTL()) $s .= '</span>';
+ if($wgLang->isRTL()) $s .= '</span>';
return $s;
}
*/
function outputPage( &$out ) {
global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut;
- global $wgScript, $wgStylePath, $wgContLanguageCode;
+ global $wgScript, $wgStylePath, $wgLanguageCode, $wgContLanguageCode;
global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgHideInterlanguageLinks;
global $wgMaxCredits, $wgShowCreditsIfMax;
$tpl->setRef( 'stylepath', $wgStylePath );
$tpl->setRef( 'logopath', $wgLogo );
$tpl->setRef( "lang", $wgContLanguageCode );
- $tpl->set( 'dir', $wgContLang->isRTL() ? "rtl" : "ltr" );
- $tpl->set( 'rtl', $wgContLang->isRTL() );
+ $tpl->setRef( 'uselang', $wgLanguageCode );
+ $tpl->set( 'dir', $wgLang->isRTL() ? "rtl" : "ltr" );
+ $tpl->set( 'rtl', $wgLang->isRTL() );
+ /* display, if needed, dir=ltr or dir=rtl for the
+ firstHeading title. This is when the title is
+ content, eg a site-localized string;
+ that is the case for all the pages not in Special:
+ when action is view or history
+ */
+ $tpl->set( 'titledir',
+ ($this->mTitle->getNamespace() != NS_SPECIAL &&
+ ($action == 'view' || $action == 'history')) ?
+ contentdir() : ""
+ );
$tpl->set( 'langname', $wgContLang->getLanguageName( $wgContLanguageCode ) );
$tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) );
$tpl->setRef( 'username', $this->username );
$nt = Title::newFromText( $l );
$language_urls[] = array(
'href' => $nt->getFullURL(),
- 'text' => ($wgContLang->getLanguageName( $nt->getInterwiki()) != ''?$wgContLang->getLanguageName( $nt->getInterwiki()) : $l),
+ 'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?$wgLang->getLanguageName( $nt->getInterwiki()) : $l),
'class' => $class
);
}
$fname = 'SkinTemplate::setupUserCss';
wfProfileIn( $fname );
- global $wgRequest, $wgAllowUserCss, $wgUseSiteCss, $wgContLang, $wgSquidMaxage, $wgStylePath, $wgUser;
+ global $wgRequest, $wgAllowUserCss, $wgUseSiteCss, $wgLang, $wgContLang, $wgSquidMaxage, $wgStylePath, $wgUser;
$sitecss = '';
$usercss = '';
$siteargs .= '&ts=' . $wgUser->mTouched;
}
- if ($wgContLang->isRTL()) $sitecss .= '@import "' . $wgStylePath . '/' . $this->stylename . '/rtl.css";' . "\n";
+ if ($wgLang->isRTL()) $sitecss .= '@import "' . $wgStylePath . '/' . $this->stylename . '/rtl.css";' . "\n";
+ if ($wgContLang->isRTL()) $sitecss .= '@import "' . $wgStylePath . '/' . $this->stylename . '/content_rtl.css";' . "\n";
# If we use the site's dynamic CSS, throw that in, too
if ( $wgUseSiteCss ) {
}
function doGetUserStyles() {
- global $wgOut;
+ global $wgOut, $wgLang, $wgUser;
$s = parent::doGetUserStyles();
$qb = $this->qbSetting();
- if ( 2 == $qb ) { # Right
+ if ( (!$wgUser->isLoggedIn() && $wgLang->isRTL() ) ||
+ ( 2 == $qb ) ) { # Right
$s .= "#quickbar { position: absolute; right: 4px; }\n" .
"#article { margin-left: 4px; margin-right: 148px; }\n";
- } else if ( 1 == $qb ) {
+ } else if ( (!$wgUser->isLoggedIn()) || ( 1 == $qb ) ) {
$s .= "#quickbar { position: absolute; left: 4px; }\n" .
"#article { margin-left: 148px; margin-right: 4px; }\n";
} else if ( 3 == $qb ) { # Floating left
wfSuppressWarnings();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('uselang') ?>" lang="<?php $this->text('uselang') ?>" dir="<?php $this->text('dir') ?>">
<head>
<meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
<?php $this->html('headlinks') ?>
<div id="content">
<a name="top" id="top"></a>
<?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
- <h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->text('title'):$this->html('title') ?></h1>
+ <h1 class="firstHeading"<?php $this->text('titledir') ?>><?php $this->data['displaytitle']!=""?$this->text('title'):$this->html('title') ?></h1>
<div id="bodyContent">
<h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
<div id="contentSub"><?php $this->html('subtitle') ?></div>
<h5><?php $this->msg('personaltools') ?></h5>
<div class="pBody">
<ul>
+<?php if ($this->data['rtl'] == "1")
+ $this->data['personal_urls'] =
+ array_reverse($this->data['personal_urls'], true); ?>
<?php foreach($this->data['personal_urls'] as $key => $item) { ?>
<li id="pt-<?php echo htmlspecialchars($key) ?>"<?php
if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
*
*/
function doGetUserStyles() {
- global $wgStylePath;
+ global $wgStylePath, $wgLang, $wgUser;
$s = parent::doGetUserStyles();
$qb = $this->qbSetting();
- if ( 2 == $qb ) { # Right
+ if ( (!$wgUser->isLoggedIn() && $wgLang->isRTL() ) ||
+ ( 2 == $qb ) ) { # Right
$s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
"border-left: 2px solid #000000; }\n" .
"#article { margin-left: 4px; margin-right: 152px; }\n";
- } else if ( 1 == $qb || 3 == $qb ) {
+ } else if ( (!$wgUser->isLoggedIn()) ||
+ ( 1 == $qb || 3 == $qb ) ) {
$s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
"border-right: 1px solid gray; }\n" .
"#article { margin-left: 152px; margin-right: 4px; }\n";
}
function doAfterContent() {
- global $wgContLang;
+ global $wgLang;
$fname = 'SkinStandard::doAfterContent';
wfProfileIn( $fname );
wfProfileIn( $fname.'-1' );
$qb = $this->qbSetting();
$shove = ($qb != 0);
$left = ($qb == 1 || $qb == 3);
- if($wgContLang->isRTL()) $left = !$left;
+ if($wgLang->isRTL()) $left = !$left;
if ( $shove && $left ) { # Left
$s .= $this->getQuickbarCompensator();
}
wfProfileOut( $fname.'-2' );
wfProfileIn( $fname.'-3' );
- $l = $wgContLang->isRTL() ? 'right' : 'left';
+ $l = $wgLang->isRTL() ? 'right' : 'left';
$s .= "<td class='bottom' align='$l' valign='top'>";
$s .= $this->bottomLinks();
--- /dev/null
+/* RTL specific styles for date content (not layout) go here */
--- /dev/null
+/*
+Right-to-left fixes for MonoBook.
+Places sidebar on right, tweaks various alignment issues.
+
+Works mostly ok nicely on Safari 1.2.1; fine in Mozilla.
+
+Safari bugs (1.2.1):
+* Tabs are still appearing in left-to-right order. (Try after localizing)
+
+Opera bugs (7.23 linux):
+* Some bits of ltr text (sidebar box titles) have forward and backward versions overlapping each other
+
+IE/mac bugs:
+* The thing barfs on Hebrew and Arabic anyway, so no point testing.
+
+Missing features due to lack of support:
+* external link icons
+
+To test:
+* Opera6
+* IE 5.0
+* etc
+
+*/
+#realContent {
+ direction: rtl;
+/* unicode-bidi: bidi-override;*/
+ unicode-bidi: embed;
+}
+
+/* Fix alignment */
+.documentByLine {
+ text-align: left;
+}
+
+div div.thumbcaption {
+ text-align: right;
+}
+
+div.magnify,
+#div.townBox {
+ left: auto;
+ right: 0;
+}
+
+/* Fix margins for non-css2 browsers */
+/* top right bottom left */
+
+ul {
+ margin-left: 0;
+ margin-right: 1.5em;
+}
+ol {
+ margin-left: 0;
+ margin-right: 2.4em;
+}
+dd {
+ margin-left: 0;
+ margin-right: 1.6em;
+}
+/* ??? */
+li {
+ margin-left: 0;
+ margin-right: 2.4em;
+}
+.tocindent {
+ margin-left: 0;
+ margin-right: 2em;
+}
+div.tright, div.floatright, table.floatright {
+ clear: none;
+}
+div.tleft, div.floatleft, table.floatleft {
+ clear: left;
+}
+div.townBox {
+ margin-left: 0;
+ margin-right: 1em;
+}
+div.townBox dl dd {
+ margin-left: 0;
+ margin-right: 1.1em;
+}
+/* Fix link icons */
+.external {
+ padding: 0 !important;
+ background: none !important;
+}
+
+
+
+/* workaround for moz bug, displayed bullets on left side */
+
+#toc ul {
+ text-align: right;
+}
+
+#toc ul ul {
+ margin: 0 2em 0 0;
+}
** keep the whitespace in front of the ^=, hides rule from konqueror
** this is css3, the validator doesn't like it when validating as css2
*/
-#bodyContent a.external,
+#bodyContent a.external[DIR="ltr"],
#bodyContent a[href ^="gopher://"] {
background: url(external.png) center right no-repeat;
padding-right: 13px;
list-style-type: square;
list-style-image: url(bullet.gif);
font-size: 95%;
+ margin: .3em 0 0 1.5em;
+ padding: 0;
}
.portlet li {
padding: 0;
}
#p-navigation .pBody {
- padding-right: 0;
+/* padding-right: 0; */
}
#p-navigation a {
}
/* Fix alignment */
-.documentByLine,
.portletDetails,
.portletMore,
#p-personal {
text-align: left;
}
-
-div div.thumbcaption {
- text-align: right;
-}
-
-div.magnify,
-#div.townBox,
#p-logo {
left: auto;
right: 0;
left: auto;
right: 0;
}
+#p-navigation .pBody {
+ padding-right: auto;
+}
+/* the icon in front of the user name, single quotes
+in bg url to hide it from iemac */
+li#pt-userpage,
+li#pt-anonuserpage,
+li#pt-login {
+ background: url(user.gif) top right no-repeat;
+ padding-left: 0px;
+ padding-right: 20px;
+ text-transform: none;
+}
#p-cactions {
left: auto;
right: 11.5em;
/* Fix margins for non-css2 browsers */
/* top right bottom left */
-ul {
+.portlet ul {
margin-left: 0;
margin-right: 1.5em;
}
-ol {
+.portlet ol {
margin-left: 0;
margin-right: 2.4em;
}
-dd {
+.portlet dd {
margin-left: 0;
margin-right: 1.6em;
}
margin-right: 1em;
margin-left: 0;
}
-.tocindent {
- margin-left: 0;
- margin-right: 2em;
-}
-div.tright, div.floatright, table.floatright {
- clear: none;
-}
-div.tleft, div.floatleft, table.floatleft {
- clear: left;
-}
-div.townBox {
- margin-left: 0;
- margin-right: 1em;
-}
-div.townBox dl dd {
- margin-left: 0;
- margin-right: 1.1em;
-}
#p-personal li {
margin-left: 0;
margin-right: 1em;
#p-personal li {
float: left;
}
-/* Fix link icons */
-.external {
- padding: 0 !important;
- background: none !important;
-}
#footer {
clear: both;
}
padding-right: 2em;
}
-/* workaround for moz bug, displayed bullets on left side */
-
-#toc ul {
- text-align: right;
-}
-
-#toc ul ul {
- margin: 0 2em 0 0;
-}
-
input#wpSave, input#wpDiff {
margin-right: 0;
margin-left: .33em;