Page MenuHomePhabricator

Add {{PLURAL:...}} to navigation bar of special:whatlinkshere
Closed, ResolvedPublic

Description

Author: D.U.Thibault

Description:
Trying to use PLURAL: with messages such as
http://fr.wiktionary.org/wiki/Discussion_MediaWiki:Nextn, I've come to the
conclusion the implementation is defective (or my understanding is deeply
flawed). It seems the parameters passed to PLURAL: within the context of
mediawiki messages fail to pass the numeric test, regardless of their value
(e.g. {{PLURAL:$1||s}} returns '' instead of 's' for $1 = 2 or better).
Currently, the function reads:

function convertPlural($count, $w1, $w2, $w3, $w4, $w5) {
return $count <= '1' ? $w1 : $w2;
}

I suspect it should be instead:

function convertPlural($count, $w1, $w2, $w3, $w4, $w5) {
return $count <= 1 ? $w1 : $w2;
}


Version: unspecified
Severity: normal
URL: http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/classes/LanguageFr.php

Details

Reference
bz9194

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:38 PM
bzimport set Reference to bz9194.
bzimport added a subscriber: Unknown Object (MLST).

D.U.Thibault wrote:

As explained (in French) on
http://fr.wiktionary.org/wiki/Discussion_MediaWiki:Nextn, setting
http://fr.wiktionary.org/wiki/MediaWiki:Nextn to:

$1 suivant{{PLURAL:$1||s}}

And then generating the pages:

http://fr.wiktionary.org/w/index.php?title=Special:Whatlinkshere/-issime&limit=1&from=0

  • and *

http://fr.wiktionary.org/w/index.php?title=Special:Whatlinkshere/-issime&limit=2&from=0

Should give (Nextn output in bold):

  • "Voir (1 précédents) ('''1 suivant''') (20 | 50 | 100 | 250 | 500)."
  • and:
  • "Voir (2 précédents) ('''2 suivants''') (20 | 50 | 100 | 250 | 500)."

But actually yields:

  • "Voir (1 précédents) ('''1 suivant''') (20 | 50 | 100 | 250 | 500)."
  • and
  • "Voir (2 précédents) ('''2 suivant''') (20 | 50 | 100 | 250 | 500)."

The code is correct, those messages just don't support plural (yet).

D.U.Thibault wrote:

Say what? The messages are invoked (if you change them, the results are
immediately apparent), so how could the parser not pass the buck on to the
plural function? Please explain.

They either do not go through parser or go through it too early before the
number is substituted.

D.U.Thibault wrote:

Ah, I see. So the software either strips the template out completely, or passes
it the unmodified string "$1". Should be easy to fix, no?

If someone want to fix it, I may point to bug 4777: Separate messages 'prevn',
'netxn'