As reported on
https://www.mediawiki.org/wiki/Thread:Extension_talk:ParserFunctions/Use_comma_as_decimal_separator
and
https://pt.wikipedia.org/w/index.php?oldid=36562067&uselang=en#Re:_Casas_decimais_no_ParserFunctions
a code such as {{#expr: 1,5 * 3 }} doesn't work on ptwiki:
https://pt.wikipedia.org/w/index.php?oldid=36571994&uselang=en
(Expression error: Unrecognized punctuation character ",".)
Currently, we have the following on languages/messages/MessagesPt.php:
$separatorTransformTable = array( ',' => "\xc2\xa0", '.' => ',' );
so, the character "," should be treated as the decimal separator, and the result should be 4.5, as if the user had used {{#expr: 1.5 * 3 }} on enwiki.
A user suggested at
https://www.mediawiki.org/wiki/Thread:Extension_talk:ParserFunctions/Use_comma_as_decimal_separator/reply_(3)
the following change:
Add
$expr = str_replace( ',', '.', $expr );
to the begin of ExprParser::doExpression() and replaced line 82 in ExtParserFunctions::expr() with
$result = self::getExprParser()->doExpression( $expr );
$result = $parser->mOptions->mUserLang->formatNum( $result );
return $result;
The first replaces all commas in a given expression with dots and the second formats the output in the user language.
Could something like this be changed in the extension's code, for use on Portuguese Wikipedia?
Version: unspecified
Severity: enhancement