From df100abc94c7709737f31e8e31f6770ef35b6cee Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Fri, 8 Jan 2010 03:34:04 +0000 Subject: [PATCH] Follow up r60798 & r60785 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 | 21 ++++++++++++++++++++- skins/Modern.php | 2 +- skins/MonoBook.php | 2 +- skins/Vector.php | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 1566f26e82..fa33fc61c8 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -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(); diff --git a/skins/Modern.php b/skins/Modern.php index 04d2b721ba..aa95adc9d1 100644 --- a/skins/Modern.php +++ b/skins/Modern.php @@ -113,7 +113,7 @@ class ModernTemplate extends QuickTemplate { -
html("userlangattributes") ?>> +
html("specialpageattributes") ?>>
msg('tagline') ?>
diff --git a/skins/MonoBook.php b/skins/MonoBook.php index a90250fba1..3c2c1a30ec 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -81,7 +81,7 @@ class MonoBookTemplate extends QuickTemplate { class="mediawiki text('dir'); $this->text('capitalizeallnouns') ?> text('pageclass') ?> text('skinnameclass') ?>">
-
html("userlangattributes") ?>> +
html("specialpageattributes") ?>> data['sitenotice']) { ?>
html('sitenotice') ?>

html('title') ?>

diff --git a/skins/Vector.php b/skins/Vector.php index 56481cada5..fc9f3c3539 100644 --- a/skins/Vector.php +++ b/skins/Vector.php @@ -463,7 +463,7 @@ class VectorTemplate extends QuickTemplate {
-
html('userlangattributes') ?>> +
html('specialpageattributes') ?>> data['sitenotice'] ): ?> -- 2.20.1