https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
Web browser: --- Bug ID: 54544 Summary: important fix for i18n.py Product: Pywikibot Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
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.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
--- Comment #1 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- fixed and tested version
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://sourceforge.net/p/p | |ywikipediabot/patches/617
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Priority|Unprioritized |High Status|NEW |PATCH_TO_REVIEW CC| |info@gno.de Component|General |i18n Severity|normal |minor
--- Comment #2 from xqt info@gno.de --- see https://gerrit.wikimedia.org/r/#/c/80698/
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
--- Comment #3 from Gerrit Notification Bot gerritadmin@wikimedia.org --- 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
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
--- Comment #4 from xqt info@gno.de --- This bug is not related to gerrit 91414 but to Gerrit 80698
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
Ricordisamoa ricordisamoa@live.it changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ricordisamoa@live.it
--- Comment #5 from Ricordisamoa ricordisamoa@live.it --- (In reply to comment #0)
Reported by: Anonymous user
That was me.
@xqt: any updates?
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
--- Comment #6 from xqt info@gno.de --- Ah yes. I am just testing a new function for both translation methods to prevent code duplication. Hm, it should become ready to commit ;)
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
Ricordisamoa ricordisamoa@live.it changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |core (2.0) Summary|important fix for i18n.py |support multiple | |occurrences of {{PLURAL}} | |within a single message
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|core (2.0) |unspecified
--- Comment #7 from xqt info@gno.de --- Important for both.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
--- Comment #8 from Ricordisamoa ricordisamoa@live.it --- Ok, so please take care of the backport when you're finished ;-)
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
--- Comment #9 from Ricordisamoa ricordisamoa@live.it --- https://gerrit.wikimedia.org/r/80698/ merged, waiting for https://gerrit.wikimedia.org/r/119338/
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |RESOLVED Resolution|--- |FIXED
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |---
--- Comment #10 from xqt info@gno.de --- Same for compat
https://bugzilla.wikimedia.org/show_bug.cgi?id=54544
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jayvdb@gmail.com Version|unspecified |compat (1.0)
pywikipedia-bugs@lists.wikimedia.org