Last modified: 2014-04-28 15:48:40 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T54426, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 52426 - Make {{#expr: ... }} work with localized separators
Make {{#expr: ... }} work with localized separators
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-01 22:03 UTC by Helder
Modified: 2014-04-28 15:48 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Helder 2013-08-01 22:03:49 UTC
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?
Comment 1 Helder 2014-04-28 15:48:40 UTC
Someone?

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links