Revision: 3926
Author: wikipedian
Date: 2007-07-31 12:17:29 +0000 (Tue, 31 Jul 2007)
Log Message:
-----------
translate namespaces, so that when you run this:
python interwiki.py -lang:de "Kategorie:Tour de France" -hint:fr
the bot will not load [[fr:Kategorie:Tour de France]], but
[[fr:Cat?\195?\169gorie:Tour de France]].
Modified Paths:
--------------
trunk/pywikipedia/titletranslate.py
Modified: trunk/pywikipedia/titletranslate.py
===================================================================
--- trunk/pywikipedia/titletranslate.py 2007-07-29 22:18:58 UTC (rev 3925)
+++ trunk/pywikipedia/titletranslate.py 2007-07-31 12:17:29 UTC (rev 3926)
@@ -31,7 +31,12 @@
# if given as -hint:xy or -hint:xy:, assume that there should
# be a page in language xy with the same title as the page
# we're currently working on
- newname = page.title()
+ ns = page.namespace()
+ if ns:
+ newname = u'%s:%s' %
(site.family.namespace('_default', ns), page.titleWithoutNamespace())
+ else:
+ # article in the main namespace
+ newname = page.title()
try:
number = int(codes)
codes = site.family.languages_by_size[:number]
Show replies by thread