http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9359
Revision: 9359
Author: xqt
Date: 2011-07-10 12:22:39 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
i18n support for basic.py
Modified Paths:
--------------
trunk/pywikipedia/basic.py
Modified: trunk/pywikipedia/basic.py
===================================================================
--- trunk/pywikipedia/basic.py 2011-07-10 12:22:09 UTC (rev 9358)
+++ trunk/pywikipedia/basic.py 2011-07-10 12:22:39 UTC (rev 9359)
@@ -16,7 +16,7 @@
and the bot will only work on that single page.
"""
#
-# (C) Pywikipedia bot team, 2006-2010
+# (C) Pywikipedia bot team, 2006-2011
#
# Distributed under the terms of the MIT license.
#
@@ -25,6 +25,7 @@
import wikipedia as pywikibot
import pagegenerators
+from pywikibot import i18n
# This is required for the text that is shown when you run this script
# with the parameter -help.
@@ -33,26 +34,9 @@
}
class BasicBot:
- # Edit summary message that should be used.
- # NOTE: Put a good description here, and add translations, if possible!
- msg = {
- 'ar': u'روبوت: تغيير ...',
- 'cs': u'Robot změnil ...',
- 'de': u'Bot: Ändere ...',
- 'en': u'Robot: Changing ...',
- 'fa': u'ربات: تغییر ...',
- 'fr': u'Robot: Changé ...',
- 'ja':u'ロボットによる:編集',
- 'ksh': u'Bot: Änderung ...',
- 'nds': u'Bot: Ännern ...',
- 'nl': u'Bot: wijziging ...',
- 'pl': u'Bot: zmienia ...',
- 'pt': u'Bot: alterando...',
- 'ru': u'Бот: изменил ...',
- 'sv': u'Bot: Ändrar ...',
- 'uk': u'Бот: змінив ...',
- 'zh': u'機器人:編輯.....',
- }
+ # Edit summary message that should be used is placed on /i18n subdirectory.
+ # The file containing these messages should have the same name as the caller
+ # script (i.e. basic.py in this case)
def __init__(self, generator, dry):
"""
@@ -67,7 +51,7 @@
self.generator = generator
self.dry = dry
# Set the edit summary message
- self.summary = pywikibot.translate(pywikibot.getSite(), self.msg)
+ self.summary = i18n.twtranslate(pywikibot.getSite(), 'basic-changing')
def run(self):
for page in self.generator:
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9358
Revision: 9358
Author: xqt
Date: 2011-07-10 12:22:09 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
minor changes. i18n files _should_ have the same name.
Modified Paths:
--------------
branches/rewrite/scripts/basic.py
Modified: branches/rewrite/scripts/basic.py
===================================================================
--- branches/rewrite/scripts/basic.py 2011-07-10 11:34:35 UTC (rev 9357)
+++ branches/rewrite/scripts/basic.py 2011-07-10 12:22:09 UTC (rev 9358)
@@ -24,7 +24,8 @@
#
import pywikibot
-from pywikibot import pagegenerators, i18n
+from pywikibot import pagegenerators
+from pywikibot import i18n
# This is required for the text that is shown when you run this script
# with the parameter -help.
@@ -34,7 +35,7 @@
class BasicBot:
# Edit summary message that should be used is placed on /i18n subdirectory.
- # The file containing these messages must have the same name as the caller
+ # The file containing these messages should have the same name as the caller
# script (i.e. basic.py in this case)
def __init__(self, generator, dry):