Follow up r60798 & r60785
authorMark A. Hershberger <mah@users.mediawiki.org>
Fri, 8 Jan 2010 03:34:04 +0000 (03:34 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Fri, 8 Jan 2010 03:34:04 +0000 (03:34 +0000)
Re-introduce specialpageattributes and add an explanation in the comments why it should be different than userlangattributes.  Also add comments explaining exactly what is going with the special attributes and why.  Clean up warnings.

includes/SkinTemplate.php
skins/Modern.php
skins/MonoBook.php
skins/Vector.php

index 1566f26..fa33fc6 100644 (file)
@@ -304,7 +304,26 @@ class SkinTemplate extends Skin {
                $tpl->setRef( 'userpage', $this->userpage );
                $tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href'] );
                $tpl->set( 'userlang', $wgLang->getCode() );
-               $tpl->set( 'userlangattributes', 'lang="' . $wgLang->getCode() . '" xml:lang="' . $wgLang->getCode() . '" dir="' . $wgLang->getDir() . '"');
+
+               // Users can have their language set differently than the
+               // content of the wiki. For these users, tell the web browser
+               // that interface elements are in a different language.
+               $tpl->set( 'userlangattributes', '');
+               $tpl->set( 'specialpageattributes', '');
+
+               $code = $wgLang->getCode();
+               $dir  = $wgLang->getDir();
+               if ( $code !== $wgContLang->getCode() || $dir !== $wgContLang->getDir() ) {
+                       $attrs = "lang='$lang' xml:lang='$lang' dir='$dir'";
+
+                       $tpl->set( 'userlangattributes', $attrs );
+
+                       // The content of SpecialPages should be presented in the
+                       // user's language. Content of regular pages should not be touched.
+                       if($this->mTitle->isSpecialPage()) {
+                               $tpl->set( 'specialpageattributes', $attrs );
+                       }
+               }
 
                $newtalks = $wgUser->getNewMessageLinks();
 
index 04d2b72..aa95adc 100644 (file)
@@ -113,7 +113,7 @@ class ModernTemplate extends QuickTemplate {
        <!-- contentholder does nothing by default, but it allows users to style the text inside
             the content area without affecting the meaning of 'em' in #mw_content, which is used
             for the margins -->
-       <div id="mw_contentholder" <?php $this->html("userlangattributes") ?>>
+       <div id="mw_contentholder" <?php $this->html("specialpageattributes") ?>>
                <div class='mw-topboxes'>
                        <div id="mw-js-message" style="display:none;" <?php $this->html('userlangattributes')?>></div>
                        <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
index a90250f..3c2c1a3 100644 (file)
@@ -81,7 +81,7 @@ class MonoBookTemplate extends QuickTemplate {
  class="mediawiki <?php $this->text('dir'); $this->text('capitalizeallnouns') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
        <div id="globalWrapper">
                <div id="column-content">
-       <div id="content" <?php $this->html("userlangattributes") ?>>
+       <div id="content" <?php $this->html("specialpageattributes") ?>>
                <a id="top"></a>
                <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
                <h1 id="firstHeading" class="firstHeading"><?php $this->html('title') ?></h1>
index 56481ca..fc9f3c3 100644 (file)
@@ -463,7 +463,7 @@ class VectorTemplate extends QuickTemplate {
                <div id="page-base" class="noprint"></div>
                <div id="head-base" class="noprint"></div>
                <!-- content -->
-               <div id="content" <?php $this->html('userlangattributes') ?>>
+               <div id="content" <?php $this->html('specialpageattributes') ?>>
                        <a id="top"></a>
                        <div id="mw-js-message" style="display:none;" <?php $this->html('userlangattributes') ?>></div>
                        <?php if ( $this->data['sitenotice'] ): ?>