(bug 2865) Add lang attribute to firstHeading
authorAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Mon, 12 Nov 2012 17:45:22 +0000 (23:15 +0530)
committerAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Wed, 14 Nov 2012 20:48:40 +0000 (22:48 +0200)
Adds a lang attribute to <h1 id="firstHeading">.

Interface language is applied to <html> and content language is
applied to <div id="mw-content-text">. This leaves firstHeading
with the interface language, which is wrong in general. It
also causes incorrect display of the title for languages that
have custom line-height.

This patch is based on code written by Munirathnam M at
the Bangalore DevCamp (he couldn't submit it because of network
issues). It looks OK to me, but it's my first time doing anything
with $this->data in a skin, so please correct me if I'm wrong.

Change-Id: I55dd392dbf0d4f768344b66e6ceb3a023b1d5c9b

RELEASE-NOTES-1.21
skins/Modern.php
skins/MonoBook.php
skins/Vector.php

index 23e25b7..16c978d 100644 (file)
@@ -69,6 +69,8 @@ production.
 * (bug 41706) EditPage: Preloaded page should be converted if possible and needed.
 * (bug 41886) Rowspans are no longer exploded by tablesorter until the table is
   actually sorted.
+* (bug 2865)  User interface HTML elements don't use lang attribute
+  (completed the fix by adding the lang attribute to firstHeading)
 
 === API changes in 1.21 ===
 * prop=revisions can now report the contentmodel and contentformat, see docs/contenthandler.txt
index 1987c1c..ce850a0 100644 (file)
@@ -65,7 +65,10 @@ class ModernTemplate extends MonoBookTemplate {
 ?>
 
        <!-- heading -->
-       <div id="mw_header"><h1 id="firstHeading"><span dir="auto"><?php $this->html('title') ?></span></h1></div>
+       <div id="mw_header"><h1 id="firstHeading" lang="<?php
+               $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageLanguage()->getCode();
+               $this->html( 'pageLanguage' );
+       ?>"><span dir="auto"><?php $this->html('title') ?></span></h1></div>
 
        <div id="mw_main">
        <div id="mw_contentwrapper">
index 6f74273..955f05b 100644 (file)
@@ -84,7 +84,10 @@ class MonoBookTemplate extends BaseTemplate {
        <a id="top"></a>
        <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
 
-       <h1 id="firstHeading" class="firstHeading"><span dir="auto"><?php $this->html('title') ?></span></h1>
+       <h1 id="firstHeading" class="firstHeading" lang="<?php
+               $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageLanguage()->getCode();
+               $this->html( 'pageLanguage' );
+       ?>"><span dir="auto"><?php $this->html('title') ?></span></h1>
        <div id="bodyContent" class="mw-body">
                <div id="siteSub"><?php $this->msg('tagline') ?></div>
                <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div>
index 104cdde..097bdde 100644 (file)
@@ -165,7 +165,10 @@ class VectorTemplate extends BaseTemplate {
                        <!-- /sitenotice -->
                        <?php endif; ?>
                        <!-- firstHeading -->
-                       <h1 id="firstHeading" class="firstHeading"><span dir="auto"><?php $this->html( 'title' ) ?></span></h1>
+                       <h1 id="firstHeading" class="firstHeading" lang="<?php
+                               $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageLanguage()->getCode();
+                               $this->html( 'pageLanguage' );
+                       ?>"><span dir="auto"><?php $this->html( 'title' ) ?></span></h1>
                        <!-- /firstHeading -->
                        <!-- bodyContent -->
                        <div id="bodyContent">