Hello. I would like to report a bug in relation to [[MediaWiki:Wikibase-statementview-references-counter/sl]]. At [https://www.wikidata.org/wiki/Wikidata:WikiProject_Public_art Wikidata:WikiProject Public art], it shows "0 sklica", which is incorrect. Of the forms listed at [https://translatewiki.net/w/i.php?title=MediaWiki:Wikibase-statementview-references-counter/sl&action=edit translatewiki], the parser evidently takes the second stated form ('sklica') for 0 whereas the correct one would be the last one ('sklicev'). Thank you for having a look into this.
Description
Details
| Subject | Repo | Branch | Lines +/- | |
|---|---|---|---|---|
| parser: {{int:}} should transform message text in user language | mediawiki/core | master | +26 -1 |
Related Objects
- Mentioned In
- T325018: The int magic word ignores language defined rules
- Mentioned Here
- rMWdfd6988313d7: Use wfMessage() instead of wfMsgGetKey()
Event Timeline
That’s interesting – it’s broken on that page (generated via {{Statement+}}) but working on item pages (e.g. Stolpersteine):
Might be an issue with the {{int:}} parser function?
Also I don’t think this edit is correct, {{PLURAL:}} doesn’t support explicitly naming the tags (“one”, “few”, etc.) as far as I can tell.
Thank you for the quick reply and the printscreens.
Ok, I will revert if you say it's incorrect. I have edited this way because of the bug and because I sometimes get a warning in translatewiki.net "The expected syntax is {{PLURAL:$1|one=|two=|few=|many}} " (or something along this line).
{{PLURAL:}} supports numbered arguments. The last non-numbered argument is the "many" parts. It is valid to use "0=" there.
When looking at the "in other languages" page on translatewiki for this message there are already usage of that - https://translatewiki.net/w/i.php?title=Special:Translations&message=MediaWiki%3AWikibase-statementview-references-counter
And it looks like working: https://www.wikidata.org/wiki/Q557141?uselang=sms
It is a issue with use of {{int:}} and that means in core and not for this message or extension.
When the parser function is used, the message is fetched and Message::plain is called. That returns for this message in the user language the wikitext 0 {{PLURAL:0|sklic|sklica|sklici|sklicev}}. This wikitext is parsed further in the content language. PLURAL in english language only supports two forms (1 and not 1), so it pick up the second ("sklica"). The plural needs to be parsed in the user language as well, so the transform of {{ must be done in the message, that's what Message::text exists for, that would expand all templates and parser functions, like grammar, which is good. But it can also have some other effects, not sure.
It is there since very long (before dfd6988313d7033c8294d4b1ce7d9e92604501dc)
Change 875958 had a related patch set uploaded (by Umherirrender; author: Umherirrender):
[mediawiki/core@master] parser: {{int:}} should transform message text in user language
Just to comment on this last part; That is because {{PLURAL}} works differently on different projects in Translatewiki. The syntax for non-MediaWiki projects (e.g. mobile apps or external websites) usually use the one=|two=|… form, but MediaWiki itself uses a slightly different syntax. The MediaWiki version normally only has unnamed arguments (so e.g. {{PLURAL:$1|one|few|many}}, depending on the language you're translating to), but also optionally supports named arguments, so you can define something specific for certain integers; thus you can have {{PLURAL:$1|one|few|many|0=none}}, for instance. I would, however, not recommend using that in this specific message, since the problem (as already described by @Umherirrender) is that the message is parsed as if it were English, because it is transcluded on a page set to the default language (which for Wikidata is English).
Change 875958 abandoned by Umherirrender:
[mediawiki/core@master] parser: {{int:}} should transform message text in user language
Reason:
Too many side effects

