Index: branches/wmf/1.19wmf1/includes/parser/Parser.php |
— | — | @@ -370,13 +370,16 @@ |
371 | 371 | */ |
372 | 372 | if ( !( $wgDisableLangConversion |
373 | 373 | || isset( $this->mDoubleUnderscores['nocontentconvert'] ) |
374 | | - || $this->mTitle->isConversionTable() |
375 | | - || $this->mOptions->getInterfaceMessage() ) ) { |
376 | | - |
377 | | - # The position of the convert() call should not be changed. it |
378 | | - # assumes that the links are all replaced and the only thing left |
379 | | - # is the <nowiki> mark. |
380 | | - $text = $this->getFunctionLang()->convert( $text ); |
| 374 | + || $this->mTitle->isConversionTable() ) ) |
| 375 | + { |
| 376 | + # Run convert unconditionally in 1.18-compatible mode |
| 377 | + global $wgBug34832TransitionalRollback; |
| 378 | + if ( $wgBug34832TransitionalRollback || !$this->mOptions->getInterfaceMessage() ) { |
| 379 | + # The position of the convert() call should not be changed. it |
| 380 | + # assumes that the links are all replaced and the only thing left |
| 381 | + # is the <nowiki> mark. |
| 382 | + $text = $this->getConverterLanguage()->convert( $text ); |
| 383 | + } |
381 | 384 | } |
382 | 385 | |
383 | 386 | /** |
— | — | @@ -392,11 +395,11 @@ |
393 | 396 | || isset( $this->mDoubleUnderscores['notitleconvert'] ) |
394 | 397 | || $this->mOutput->getDisplayTitle() !== false ) ) |
395 | 398 | { |
396 | | - $convruletitle = $this->getFunctionLang()->getConvRuleTitle(); |
| 399 | + $convruletitle = $this->getConverterLanguage()->getConvRuleTitle(); |
397 | 400 | if ( $convruletitle ) { |
398 | 401 | $this->mOutput->setTitleText( $convruletitle ); |
399 | 402 | } else { |
400 | | - $titleText = $this->getFunctionLang()->convertTitle( $title ); |
| 403 | + $titleText = $this->getConverterLanguage()->convertTitle( $title ); |
401 | 404 | $this->mOutput->setTitleText( $titleText ); |
402 | 405 | } |
403 | 406 | } |
— | — | @@ -692,9 +695,18 @@ |
693 | 696 | } |
694 | 697 | |
695 | 698 | /** |
| 699 | + * Get a language object for use in parser functions such as {{FORMATNUM:}} |
696 | 700 | * @return Language |
697 | 701 | */ |
698 | 702 | function getFunctionLang() { |
| 703 | + return $this->getTargetLanguage(); |
| 704 | + } |
| 705 | + |
| 706 | + /** |
| 707 | + * Get the target language for the content being parsed. This is usually the |
| 708 | + * language that the content is in. |
| 709 | + */ |
| 710 | + function getTargetLanguage() { |
699 | 711 | $target = $this->mOptions->getTargetLanguage(); |
700 | 712 | if ( $target !== null ) { |
701 | 713 | return $target; |
— | — | @@ -707,6 +719,18 @@ |
708 | 720 | } |
709 | 721 | |
710 | 722 | /** |
| 723 | + * Get the language object for language conversion |
| 724 | + */ |
| 725 | + function getConverterLanguage() { |
| 726 | + global $wgBug34832TransitionalRollback, $wgContLang; |
| 727 | + if ( $wgBug34832TransitionalRollback ) { |
| 728 | + return $wgContLang; |
| 729 | + } else { |
| 730 | + return $this->getTargetLanguage(); |
| 731 | + } |
| 732 | + } |
| 733 | + |
| 734 | + /** |
711 | 735 | * Get a User object either from $this->mUser, if set, or from the |
712 | 736 | * ParserOptions object otherwise |
713 | 737 | * |
— | — | @@ -1225,7 +1249,8 @@ |
1226 | 1250 | $text = $this->maybeMakeExternalImage( $url ); |
1227 | 1251 | if ( $text === false ) { |
1228 | 1252 | # Not an image, make a link |
1229 | | - $text = Linker::makeExternalLink( $url, $this->getFunctionLang()->markNoConversion($url), true, 'free', |
| 1253 | + $text = Linker::makeExternalLink( $url, |
| 1254 | + $this->getConverterLanguage()->markNoConversion($url), true, 'free', |
1230 | 1255 | $this->getExternalLinkAttribs( $url ) ); |
1231 | 1256 | # Register it in the output object... |
1232 | 1257 | # Replace unnecessary URL escape codes with their equivalent characters |
— | — | @@ -1489,7 +1514,7 @@ |
1490 | 1515 | # No link text, e.g. [http://domain.tld/some.link] |
1491 | 1516 | if ( $text == '' ) { |
1492 | 1517 | # Autonumber |
1493 | | - $langObj = $this->getFunctionLang(); |
| 1518 | + $langObj = $this->getTargetLanguage(); |
1494 | 1519 | $text = '[' . $langObj->formatNum( ++$this->mAutonumber ) . ']'; |
1495 | 1520 | $linktype = 'autonumber'; |
1496 | 1521 | } else { |
— | — | @@ -1498,7 +1523,7 @@ |
1499 | 1524 | list( $dtrail, $trail ) = Linker::splitTrail( $trail ); |
1500 | 1525 | } |
1501 | 1526 | |
1502 | | - $text = $this->getFunctionLang()->markNoConversion( $text ); |
| 1527 | + $text = $this->getConverterLanguage()->markNoConversion( $text ); |
1503 | 1528 | |
1504 | 1529 | $url = Sanitizer::cleanUrl( $url ); |
1505 | 1530 | |
— | — | @@ -1678,7 +1703,7 @@ |
1679 | 1704 | $line = $a->current(); # Workaround for broken ArrayIterator::next() that returns "void" |
1680 | 1705 | $s = substr( $s, 1 ); |
1681 | 1706 | |
1682 | | - $useLinkPrefixExtension = $this->getFunctionLang()->linkPrefixExtension(); |
| 1707 | + $useLinkPrefixExtension = $this->getTargetLanguage()->linkPrefixExtension(); |
1683 | 1708 | $e2 = null; |
1684 | 1709 | if ( $useLinkPrefixExtension ) { |
1685 | 1710 | # Match the end of a line for a word that's not followed by whitespace, |
— | — | @@ -1704,8 +1729,9 @@ |
1705 | 1730 | $prefix = ''; |
1706 | 1731 | } |
1707 | 1732 | |
1708 | | - if ( $this->getFunctionLang()->hasVariants() ) { |
1709 | | - $selflink = $this->getFunctionLang()->autoConvertToAllVariants( $this->mTitle->getPrefixedText() ); |
| 1733 | + if ( $this->getConverterLanguage()->hasVariants() ) { |
| 1734 | + $selflink = $this->getConverterLanguage()->autoConvertToAllVariants( |
| 1735 | + $this->mTitle->getPrefixedText() ); |
1710 | 1736 | } else { |
1711 | 1737 | $selflink = array( $this->mTitle->getPrefixedText() ); |
1712 | 1738 | } |
— | — | @@ -1923,7 +1949,7 @@ |
1924 | 1950 | } |
1925 | 1951 | $sortkey = Sanitizer::decodeCharReferences( $sortkey ); |
1926 | 1952 | $sortkey = str_replace( "\n", '', $sortkey ); |
1927 | | - $sortkey = $this->getFunctionLang()->convertCategoryKey( $sortkey ); |
| 1953 | + $sortkey = $this->getConverterLanguage()->convertCategoryKey( $sortkey ); |
1928 | 1954 | $this->mOutput->addCategory( $nt->getDBkey(), $sortkey ); |
1929 | 1955 | |
1930 | 1956 | /** |
— | — | @@ -3022,7 +3048,7 @@ |
3023 | 3049 | * @private |
3024 | 3050 | */ |
3025 | 3051 | function braceSubstitution( $piece, $frame ) { |
3026 | | - global $wgNonincludableNamespaces; |
| 3052 | + global $wgNonincludableNamespaces, $wgContLang; |
3027 | 3053 | wfProfileIn( __METHOD__ ); |
3028 | 3054 | wfProfileIn( __METHOD__.'-setup' ); |
3029 | 3055 | |
— | — | @@ -3125,7 +3151,7 @@ |
3126 | 3152 | $function = $this->mFunctionSynonyms[1][$function]; |
3127 | 3153 | } else { |
3128 | 3154 | # Case insensitive functions |
3129 | | - $function = $this->getFunctionLang()->lc( $function ); |
| 3155 | + $function = $wgContLang->lc( $function ); |
3130 | 3156 | if ( isset( $this->mFunctionSynonyms[0][$function] ) ) { |
3131 | 3157 | $function = $this->mFunctionSynonyms[0][$function]; |
3132 | 3158 | } else { |
— | — | @@ -3201,8 +3227,8 @@ |
3202 | 3228 | if ( $title ) { |
3203 | 3229 | $titleText = $title->getPrefixedText(); |
3204 | 3230 | # Check for language variants if the template is not found |
3205 | | - if ( $this->getFunctionLang()->hasVariants() && $title->getArticleID() == 0 ) { |
3206 | | - $this->getFunctionLang()->findVariantLink( $part1, $title, true ); |
| 3231 | + if ( $this->getConverterLanguage()->hasVariants() && $title->getArticleID() == 0 ) { |
| 3232 | + $this->getConverterLanguage()->findVariantLink( $part1, $title, true ); |
3207 | 3233 | } |
3208 | 3234 | # Do recursion depth check |
3209 | 3235 | $limit = $this->mOptions->getMaxTemplateDepth(); |
— | — | @@ -4033,7 +4059,7 @@ |
4034 | 4060 | if ( $dot ) { |
4035 | 4061 | $numbering .= '.'; |
4036 | 4062 | } |
4037 | | - $numbering .= $this->getFunctionLang()->formatNum( $sublevelCount[$i] ); |
| 4063 | + $numbering .= $this->getTargetLanguage()->formatNum( $sublevelCount[$i] ); |
4038 | 4064 | $dot = 1; |
4039 | 4065 | } |
4040 | 4066 | } |
Index: branches/wmf/1.19wmf1/includes/cache/MessageCache.php |
— | — | @@ -833,14 +833,9 @@ |
834 | 834 | |
835 | 835 | $parser = $this->getParser(); |
836 | 836 | $popts = $this->getParserOptions(); |
| 837 | + $popts->setInterfaceMessage( $interface ); |
| 838 | + $popts->setTargetLanguage( $language ); |
837 | 839 | |
838 | | - if ( $interface ) { |
839 | | - $popts->setInterfaceMessage( true ); |
840 | | - } |
841 | | - if ( $language !== null ) { |
842 | | - $popts->setTargetLanguage( $language ); |
843 | | - } |
844 | | - |
845 | 840 | wfProfileIn( __METHOD__ ); |
846 | 841 | if ( !$title || !$title instanceof Title ) { |
847 | 842 | global $wgTitle; |
Property changes on: branches/wmf/1.19wmf1/includes/cache/MessageCache.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
848 | 843 | Merged /trunk/phase3/includes/cache/MessageCache.php:r112872-112873,113001,113024 |
Index: branches/wmf/1.19wmf1/includes/DefaultSettings.php |
— | — | @@ -2177,6 +2177,17 @@ |
2178 | 2178 | */ |
2179 | 2179 | $wgLocalTZoffset = null; |
2180 | 2180 | |
| 2181 | +/** |
| 2182 | + * If set to true, this will roll back a few bug fixes introduced in 1.19, |
| 2183 | + * emulating the 1.18 behaviour, to avoid introducing bug 34832. In 1.19, |
| 2184 | + * language variant conversion is disabled in interface messages. Setting this |
| 2185 | + * to true re-enables it. |
| 2186 | + * |
| 2187 | + * This variable should be removed (implicitly false) in 1.20 or earlier. |
| 2188 | + */ |
| 2189 | +$wgBug34832TransitionalRollback = true; |
| 2190 | + |
| 2191 | + |
2181 | 2192 | /** @} */ # End of language/charset settings |
2182 | 2193 | |
2183 | 2194 | /*************************************************************************//** |
Index: branches/wmf/1.19wmf1/includes/specials/SpecialRecentchanges.php |
— | — | @@ -633,10 +633,13 @@ |
634 | 634 | function setTopText( FormOptions $opts ) { |
635 | 635 | global $wgContLang; |
636 | 636 | $this->getOutput()->addWikiText( |
637 | | - Html::rawElement( 'p', |
638 | | - array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ), |
639 | | - "\n" . wfMsgForContentNoTrans( 'recentchangestext' ) . "\n" |
640 | | - ), false ); |
| 637 | + Html::rawElement( 'p', |
| 638 | + array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ), |
| 639 | + "\n" . wfMsgForContentNoTrans( 'recentchangestext' ) . "\n" |
| 640 | + ), |
| 641 | + /* $lineStart */ false, |
| 642 | + /* $interface */ false |
| 643 | + ); |
641 | 644 | } |
642 | 645 | |
643 | 646 | /** |