Topic on Extension talk:ParserFunctions

Use comma as decimal separator

5
Peachey88 (Flood) (talkcontribs)

In portuguese ,and I think also in several other languages, the comma is the decimal separator and the dot is the thousand separator, but in english is the opposite. In templates that use #expr in the portuguese Wikipedia the editors fill the fields using comma as decimal separator and it frequently generate erros. How can we solve this problem?

This post was posted by Peachey88 (Flood), but signed as Danilo.mac.

He7d3r (talkcontribs)

I do have the same problem in a German Wiki

This post was posted by He7d3r, but signed as Francishunger.

He7d3r (talkcontribs)

For the record, for the separators for Portuguese (pt and pt-BR) are defined on the following line of languages/messages/MessagesPt.php (resp. MessagesPt_br.php)

$separatorTransformTable = array( ',' => "\xc2\xa0", '.' => ',' );

The problem seems to be analogous to bugzilla:19412 (which is about the {{#time: ... }} parser function).

Phorgo (talkcontribs)

I have added $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. Is this useful for you?

He7d3r (talkcontribs)

I think so. Thanks for you suggestion!

I requested this on bugzilla:52426.

Reply to "Use comma as decimal separator"