Last modified: 2014-11-02 12:50:15 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 T56544, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 54544 - support multiple occurrences of {{PLURAL}} within a single message
support multiple occurrences of {{PLURAL}} within a single message
Status: REOPENED
Product: Pywikibot
Classification: Unclassified
i18n (Other open bugs)
compat-(1.0)
All All
: High minor
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-24 22:28 UTC by Kunal Mehta (Legoktm)
Modified: 2014-11-02 12:50 UTC (History)
3 users (show)

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


Attachments

Description Kunal Mehta (Legoktm) 2013-09-24 22:28:53 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/patches/617/
Reported by: Anonymous user
Created on: 2013-05-28 23:05:42
Subject: important fix for i18n.py
Original description:
the "i18n.py" file in the "/pywikibot" directory has a useful "translate" function; but it doesn't work well with multiple "\{\{PLURAL\}\}" directives in the same string: for example, the following code:
pywikibot.i18n.translate\('en',\{'en':'%\(links\)d \{\{PLURAL:%\(links\)d|link|links\}\} and %\(apples\)d \{\{PLURAL:%\(apples\)d|apple|apples\}\}'\},\{'links':1,'apples':4\}\)
returns "1 link and 4 link" instead of "1 link and 4 apples".
I've fixed that doing a "while" loop for each \{\{PLURAL\}\} and replacing/translating only one of them at a time; probably other functions need such fixes as well.
My version is attached, feel free to improve it and include it in the pywikipediabot rewrite branch.
Comment 1 Kunal Mehta (Legoktm) 2013-09-24 22:28:55 UTC
fixed and tested version
Comment 2 xqt 2013-10-12 10:29:32 UTC
see https://gerrit.wikimedia.org/r/#/c/80698/
Comment 3 Gerrit Notification Bot 2013-10-24 16:26:29 UTC
Change 91414 had a related patch set uploaded by Ladsgroup:
Bugfix for python 2.5: "plural_rules" is the valid function

https://gerrit.wikimedia.org/r/91414
Comment 4 xqt 2013-10-24 18:22:17 UTC
This bug is not related to Gerrit change #91414 but to Gerrit change #80698
Comment 5 Ricordisamoa 2014-02-11 14:45:10 UTC
(In reply to comment #0)
> Reported by: Anonymous user

That was me.

@xqt: any updates?
Comment 6 xqt 2014-02-11 17:14:04 UTC
Ah yes. I am just testing a new function for both translation methods to prevent code duplication. Hm, it should become ready to commit ;)
Comment 7 xqt 2014-02-13 19:14:19 UTC
Important for both.
Comment 8 Ricordisamoa 2014-02-15 00:38:13 UTC
Ok, so please take care of the backport when you're finished ;-)
Comment 9 Ricordisamoa 2014-03-23 09:10:05 UTC
https://gerrit.wikimedia.org/r/80698/ merged, waiting for https://gerrit.wikimedia.org/r/119338/
Comment 10 xqt 2014-04-20 11:15:47 UTC
Same for compat

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


Navigation
Links