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

Revision: 8844
Author:   valhallasw
Date:     2011-01-16 20:15:55 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Revert fallback implementation from r8840/r8843

These implementations do not cover fallback languages correctly.

Modified Paths:
--------------
    branches/rewrite/pywikibot/i18n.py

Modified: branches/rewrite/pywikibot/i18n.py
===================================================================
--- branches/rewrite/pywikibot/i18n.py  2011-01-16 16:14:50 UTC (rev 8843)
+++ branches/rewrite/pywikibot/i18n.py  2011-01-16 20:15:55 UTC (rev 8844)
@@ -174,11 +174,10 @@
     if hasattr(code,'lang'):
         code = code.lang
 
-    # check if the subkey exists anyway
-    if code in xdict and xdict[code]:
+    if code in xdict:
         return xdict[code]
     for alt in _altlang(code):
-        if alt in xdict and xdict[alt]:
+        if alt in xdict:
             return xdict[alt]
     if '_default' in xdict:
         return xdict['_default']
@@ -198,11 +197,7 @@
     """
     package = twtitle.split("-")[0]
     transdict = getattr(__import__("i18n", fromlist=[package]), package).msg
-    twmsg = translate(code, transdict)
-    if twtitle in twmsg:
-        trans = twmsg[twtitle]
-    else:
-        trans = transdict['en'][twtitle]
+    trans = translate(code, transdict)[twtitle]
 
     if parameters:
         return trans % parameters


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

Reply via email to