From: Santhosh Thottingal Date: Fri, 13 Oct 2017 11:43:22 +0000 (+0530) Subject: Parser: Disable commafy for magic variables for month and day X-Git-Tag: 1.31.0-rc.0~1767^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=f07b32a7dd48627bc49ac25388a111987ae58bcc;p=lhc%2Fweb%2Fwiklou.git Parser: Disable commafy for magic variables for month and day In Parser#getVariableValue for the following magic variables Language#formatNum was called without commafy parameter: currentmonth, currentmonth1, currentday, currentday2, localmonth, localmonth1, localday, localday2 The default value for formatNum nocommafy is false, meaning formatNum will do commafication. For the above context, commafy is not needed since the passed values are often month values like 02, 03 etc. Commafy is noop on this values. Explicitly pass false value for formatNum's nocommafy argument. Language#formatNum method documentation for nocommafy also recommends setting it true in case of dates. Change-Id: I3233d5458af8cef583e5d1d599d9408542ba08c9 --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 49f2ce1def..f2e47dc36a 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2504,10 +2504,10 @@ class Parser { $value = '|'; break; case 'currentmonth': - $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'm' ) ); + $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'm' ), true ); break; case 'currentmonth1': - $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'n' ) ); + $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'n' ), true ); break; case 'currentmonthname': $value = $pageLang->getMonthName( MWTimestamp::getInstance( $ts )->format( 'n' ) ); @@ -2519,16 +2519,16 @@ class Parser { $value = $pageLang->getMonthAbbreviation( MWTimestamp::getInstance( $ts )->format( 'n' ) ); break; case 'currentday': - $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'j' ) ); + $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'j' ), true ); break; case 'currentday2': - $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'd' ) ); + $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'd' ), true ); break; case 'localmonth': - $value = $pageLang->formatNum( MWTimestamp::getLocalInstance( $ts )->format( 'm' ) ); + $value = $pageLang->formatNum( MWTimestamp::getLocalInstance( $ts )->format( 'm' ), true ); break; case 'localmonth1': - $value = $pageLang->formatNum( MWTimestamp::getLocalInstance( $ts )->format( 'n' ) ); + $value = $pageLang->formatNum( MWTimestamp::getLocalInstance( $ts )->format( 'n' ), true ); break; case 'localmonthname': $value = $pageLang->getMonthName( MWTimestamp::getLocalInstance( $ts )->format( 'n' ) ); @@ -2540,10 +2540,10 @@ class Parser { $value = $pageLang->getMonthAbbreviation( MWTimestamp::getLocalInstance( $ts )->format( 'n' ) ); break; case 'localday': - $value = $pageLang->formatNum( MWTimestamp::getLocalInstance( $ts )->format( 'j' ) ); + $value = $pageLang->formatNum( MWTimestamp::getLocalInstance( $ts )->format( 'j' ), true ); break; case 'localday2': - $value = $pageLang->formatNum( MWTimestamp::getLocalInstance( $ts )->format( 'd' ) ); + $value = $pageLang->formatNum( MWTimestamp::getLocalInstance( $ts )->format( 'd' ), true ); break; case 'pagename': $value = wfEscapeWikiText( $this->mTitle->getText() );