Last modified: 2014-02-17 17:44:00 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 T62604, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 60604 - CoreParserFunctions::formatRaw needs to use page language
CoreParserFunctions::formatRaw needs to use page language
Status: PATCH_TO_REVIEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-29 23:16 UTC by Tomasz W. Kozlowski
Modified: 2014-02-17 17:44 UTC (History)
6 users (show)

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


Attachments

Description Tomasz W. Kozlowski 2014-01-29 23:16:46 UTC
The parser function {{#expr: }} appears to produce different results on Translations: pages than it does in other namespaces.

This was first brought to our attention on Wikimedia Commons with this edit[1]; after some playing around, I managed to isolate the problem to {{#expr:}} with this edit[2], and confirmed the different behaviour by adding the same code to a page in my own user space[3] and then testing it again using preview at a different page in the Commons: namespace[4].

== References ==
* [1] https://commons.wikimedia.org/w/index.php?diff=prev&oldid=114102848
* [2] https://commons.wikimedia.org/w/index.php?diff=115092528&oldid=115091915
* [3] https://commons.wikimedia.org/w/index.php?oldid=115092667
* [4] https://commons.wikimedia.org/w/index.php?diff=115093149&oldid=115005227
Comment 1 Niklas Laxström 2014-01-30 09:52:34 UTC
Please provide more detail. What is the actual value? What is expected value.

"{{#expr:{{formatnum:{{PAGESINCATEGORY:Quality images}}|R}} - 100}}" is too complex example to understand what is going on.
Comment 2 Nemo 2014-01-30 09:58:12 UTC
I doubt this is a Translate bug: as I already told Odder, he/we need to verify whether #expr wants formatted or unformatted numbers and what assumptions it makes on content language...
Comment 3 Tomasz W. Kozlowski 2014-01-30 10:00:31 UTC
As demonstrated in [3], the expected value of that function is 61390; the output on that Translations: page is -38.465.

(In reply to comment #2)
> I doubt this is a Translate bug: as I already told Odder, he/we need to

The function behaves the same way on regular MediaWiki: pages (tested in NS_USER and NS_PROJECT, see above), but produces different results in Translations: — hence the assumption the bug lies in the latter.
Comment 4 Niklas Laxström 2014-01-30 10:10:31 UTC
There are at least four places where something can go wrong in that example. Please narrow it down.
Comment 5 Nemo 2014-01-30 10:13:57 UTC
(In reply to comment #3)
> The function behaves the same way on regular MediaWiki: pages (tested in
> NS_USER and NS_PROJECT, see above), but produces different results in
> Translations: — hence the assumption the bug lies in the latter.

I don't see any MediaWiki:/ns8 page in the examples. You can see the page language in action=info.
Comment 6 Tomasz W. Kozlowski 2014-01-30 10:18:22 UTC
(In reply to comment #5)

> I don't see any MediaWiki:/ns8 page in the examples. You can see the page
> language in action=info.

Ignore the colon, I meant MediaWiki pages irrespective of their namespaces.
Comment 7 Tomasz W. Kozlowski 2014-01-30 10:28:47 UTC
(In reply to comment #4)

> There are at least four places where something can go wrong in that example.
> Please narrow it down.

OK, it appears the problem lies within {{formatnum: }} and not in {{#expr:}}: compare https://commons.wikimedia.org/w/index.php?diff=115117520&oldid=115094092 and https://commons.wikimedia.org/w/index.php?diff=115117560&oldid=115092667
Comment 8 Nemo 2014-01-30 10:48:52 UTC
That's expected behaviour, formatnum is trying to unformat according to Polish rules but you provided it with an English-formatted numbers. This is a core issue, invalid for Translate and duplicate of bug 35922 for core.
Comment 9 Tomasz W. Kozlowski 2014-01-30 11:01:10 UTC
https://www.mediawiki.org/wiki/Help:Magic_words#Formatting suggests that the numbers are formatted according to the wiki's default locale, which in Commons's example is, I think, English.
Comment 10 Niklas Laxström 2014-01-30 11:02:40 UTC
The problem is that CoreParserFunctions::formatRaw uses content language and not page language while formatnum raw excepts page language.
Comment 11 Tomasz W. Kozlowski 2014-01-30 11:06:38 UTC
[Is this bug still invalid or duplicate?]
Comment 12 Gerrit Notification Bot 2014-01-30 11:19:43 UTC
Change 110342 had a related patch set uploaded by Nikerabbit:
Parser functions now format numbers according to page language

https://gerrit.wikimedia.org/r/110342
Comment 13 Tomasz W. Kozlowski 2014-02-03 21:44:44 UTC
21:34 +logmsgbot: !log bsitu synchronized wmf-config/InitialiseSettings.php  'Enable Flow on two enwiki WikiProject pages'
Comment 14 Tomasz W. Kozlowski 2014-02-03 21:45:12 UTC
Not this bug, obviously; please ignore comment 13.

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


Navigation
Links