Liangent has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/55456


Change subject: Fix various language tags used in Html attribs to use wfBCP47()
......................................................................

Fix various language tags used in Html attribs to use wfBCP47()

Change-Id: I823ffacf5a55e53d6ab5383c1a42a9199d56f11d
---
M includes/OutputPage.php
M includes/SkinLegacy.php
M includes/SkinTemplate.php
3 files changed, 10 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/56/55456/1

diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 1e0c396..3e8ab48 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -3233,7 +3233,7 @@
                                        foreach ( $variants as $_v ) {
                                                $tags["variant-$_v"] = 
Html::element( 'link', array(
                                                        'rel' => 'alternate',
-                                                       'hreflang' => $_v,
+                                                       'hreflang' => wfBCP47( 
$_v ),
                                                        'href' => 
$this->getTitle()->getLocalURL( array( 'variant' => $_v ) ) )
                                                );
                                        }
diff --git a/includes/SkinLegacy.php b/includes/SkinLegacy.php
index b9766a9..77c0d2a 100644
--- a/includes/SkinLegacy.php
+++ b/includes/SkinLegacy.php
@@ -263,7 +263,11 @@
                                }
                                $s = $wgLang->pipeList( array(
                                        $s,
-                                       '<a href="' . htmlspecialchars( 
$title->getLocalURL( 'variant=' . $code ) ) . '" lang="' . $code . '" 
hreflang="' . $code . '">' . htmlspecialchars( $varname ) . '</a>'
+                                       Html::element( 'a', array(
+                                               'href' => $title->getLocalURL( 
'variant=' . $code ),
+                                               'lang' => wfBCP47( $code ),
+                                               'hreflang' => wfBCP47( $code ),
+                                       ), $varname )
                                ) );
                        }
                }
diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php
index 59e1ccf..618e0f1 100644
--- a/includes/SkinTemplate.php
+++ b/includes/SkinTemplate.php
@@ -433,8 +433,8 @@
                                                'text' => $ilLangName,
                                                'title' => 
$languageLinkTitle->getText(),
                                                'class' => $class,
-                                               'lang' => $ilInterwikiCode,
-                                               'hreflang' => $ilInterwikiCode
+                                               'lang' => wfBCP47( 
$ilInterwikiCode ),
+                                               'hreflang' => wfBCP47( 
$ilInterwikiCode ),
                                        );
                                }
                        }
@@ -1031,8 +1031,8 @@
                                                        'class' => ( $code == 
$preferred ) ? 'selected' : false,
                                                        'text' => $varname,
                                                        'href' => 
$title->getLocalURL( array( 'variant' => $code ) + $params ),
-                                                       'lang' => $code,
-                                                       'hreflang' => $code
+                                                       'lang' => wfBCP47( 
$code ),
+                                                       'hreflang' => wfBCP47( 
$code ),
                                                );
                                        }
                                }

-- 
To view, visit https://gerrit.wikimedia.org/r/55456
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I823ffacf5a55e53d6ab5383c1a42a9199d56f11d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Liangent <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to