X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FOutputPage.php;h=8399a8cde6131207206b6fdb28e8beed87e16ad0;hb=35c222b736c3d5a5500f654f2572d54209d05cea;hp=ff83f700ada531c6212e8033f84031050f4a7a11;hpb=8db04efa6ccafbdc3841a9d4223f2ad8169004ad;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputPage.php b/includes/OutputPage.php index ff83f700ad..8399a8cde6 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1469,7 +1469,7 @@ class OutputPage extends ContextSource { * @param $interface Boolean: whether it is an interface message * (for example disables conversion) */ - public function addWikiTextTitle( $text, &$title, $linestart, $tidy = false, $interface = false ) { + public function addWikiTextTitle( $text, Title $title, $linestart, $tidy = false, $interface = false ) { global $wgParser; wfProfileIn( __METHOD__ ); @@ -1769,14 +1769,12 @@ class OutputPage extends ContextSource { } else { $aloption[] = 'string-contains=' . $variant; - // IE and some other browsers use another form of language code - // in their Accept-Language header, like "zh-CN" or "zh-TW". + // IE and some other browsers use BCP 47 standards in + // their Accept-Language header, like "zh-CN" or "zh-Hant". // We should handle these too. - $ievariant = explode( '-', $variant ); - if ( count( $ievariant ) == 2 ) { - $ievariant[1] = strtoupper( $ievariant[1] ); - $ievariant = implode( '-', $ievariant ); - $aloption[] = 'string-contains=' . $ievariant; + $variantBCP47 = wfBCP47( $variant ); + if ( $variantBCP47 !== $variant ) { + $aloption[] = 'string-contains=' . $variantBCP47; } } }