https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112442
Revision: 112442
Author: hartman
Date: 2012-02-26 16:52:37 +0000 (Sun, 26 Feb 2012)
Log Message:
-----------
Add lang and hreflang tags to the variants in the variant menu's. This fixes
bug 24742.
I have not added the rel 'alternate' links, because they are also present in
the <head>
Modified Paths:
--------------
trunk/phase3/includes/SkinLegacy.php
trunk/phase3/includes/SkinTemplate.php
trunk/phase3/skins/Vector.php
Modified: trunk/phase3/includes/SkinLegacy.php
===================================================================
--- trunk/phase3/includes/SkinLegacy.php 2012-02-26 16:04:17 UTC (rev
112441)
+++ trunk/phase3/includes/SkinLegacy.php 2012-02-26 16:52:37 UTC (rev
112442)
@@ -250,7 +250,7 @@
}
$s = $wgLang->pipeList( array(
$s,
- '<a href="' . htmlspecialchars(
$title->getLocalURL( 'variant=' . $code ) ) . '">' . htmlspecialchars( $varname
) . '</a>'
+ '<a href="' . htmlspecialchars(
$title->getLocalURL( 'variant=' . $code ) ) . '" lang="' . $code . '"
hreflang="' . $code . '">' . htmlspecialchars( $varname ) . '</a>'
) );
}
}
Modified: trunk/phase3/includes/SkinTemplate.php
===================================================================
--- trunk/phase3/includes/SkinTemplate.php 2012-02-26 16:04:17 UTC (rev
112441)
+++ trunk/phase3/includes/SkinTemplate.php 2012-02-26 16:52:37 UTC (rev
112442)
@@ -1000,7 +1000,9 @@
$content_navigation['variants'][] = array(
'class' => ( $code ==
$preferred ) ? 'selected' : false,
'text' => $varname,
- 'href' =>
$title->getLocalURL( array( 'variant' => $code ) )
+ 'href' =>
$title->getLocalURL( array( 'variant' => $code ) ),
+ 'lang' => $code,
+ 'hreflang' => $code
);
}
}
Modified: trunk/phase3/skins/Vector.php
===================================================================
--- trunk/phase3/skins/Vector.php 2012-02-26 16:04:17 UTC (rev 112441)
+++ trunk/phase3/skins/Vector.php 2012-02-26 16:52:37 UTC (rev 112442)
@@ -371,7 +371,7 @@
<div class="menu">
<ul<?php $this->html( 'userlangattributes' ) ?>>
<?php foreach ( $this->data['variant_urls'] as $link ):
?>
- <li<?php echo $link['attributes'] ?>><a
href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key']
?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
+ <li<?php echo $link['attributes'] ?>><a
href="<?php echo htmlspecialchars( $link['href'] ) ?>" lang="<?php echo
htmlspecialchars( $link['lang'] ) ?>" hreflang="<?php echo htmlspecialchars(
$link['hreflang'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars(
$link['text'] ) ?></a></li>
<?php endforeach; ?>
</ul>
</div>
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs