Last modified: 2007-04-02 07:25:42 UTC
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; }
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).
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.
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'
Fixed with r20905.