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

Revision: 8843
Author:   xqt
Date:     2011-01-16 16:14:50 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
check whether a language has no translations at all and the subkey exists. 
Otherwise use 'en' as default key.

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

Modified: branches/rewrite/pywikibot/i18n.py
===================================================================
--- branches/rewrite/pywikibot/i18n.py  2011-01-16 15:33:14 UTC (rev 8842)
+++ branches/rewrite/pywikibot/i18n.py  2011-01-16 16:14:50 UTC (rev 8843)
@@ -198,7 +198,11 @@
     """
     package = twtitle.split("-")[0]
     transdict = getattr(__import__("i18n", fromlist=[package]), package).msg
-    trans = translate(code, transdict)[twtitle]
+    twmsg = translate(code, transdict)
+    if twtitle in twmsg:
+        trans = twmsg[twtitle]
+    else:
+        trans = transdict['en'][twtitle]
 
     if parameters:
         return trans % parameters


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

Reply via email to