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.