http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11313

Revision: 11313
Author:   xqt
Date:     2013-04-01 10:52:18 +0000 (Mon, 01 Apr 2013)
Log Message:
-----------
remove debugging stuff;
fix for pre 2.5 code

Modified Paths:
--------------
    trunk/pywikipedia/pywikibot/i18n.py

Modified: trunk/pywikipedia/pywikibot/i18n.py
===================================================================
--- trunk/pywikipedia/pywikibot/i18n.py 2013-04-01 10:37:24 UTC (rev 11312)
+++ trunk/pywikipedia/pywikibot/i18n.py 2013-04-01 10:52:18 UTC (rev 11313)
@@ -304,14 +304,11 @@
         # TODO: check against plural_rules[lang]['nplurals']
         try:
             index = plural_rules[code]['plural'](num)
-            print 1, num, index
         except KeyError:
             index = plural_rules['_default']['plural'](num)
-            print 2, num, index
         except TypeError:
             # we got an int, not a function
             index = plural_rules[code]['plural']
-            print 3, index
         trans = re.sub(PLURAL_PATTERN, variants.split('|')[index], trans)
     if param:
         try:
@@ -457,6 +454,7 @@
         # to use plural.py - use _default rules for all
         if sys.version_info < (2, 5):
             plural_func = lambda n: (n != 1)
+            index = plural_rules(num)
         else:
             from plural import plural_rules
             # we only need the lang or _default, not a _altlang code
@@ -467,7 +465,7 @@
             except KeyError:
                 index = plural_rules['_default']['plural'](num)
             except TypeError:
-                # we got an int
+                # we got an int not a function
                 index = plural_rules[lang]['plural']
         repl = variants.split('|')[index]
         trans = re.sub(PLURAL_PATTERN, repl, trans)


_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn

Reply via email to