http://www.mediawiki.org/wiki/Special:Code/pywikipedia/8856
Revision: 8856 Author: xqt Date: 2011-01-18 09:29:12 +0000 (Tue, 18 Jan 2011) Log Message: ----------- i18n for basic.py
Modified Paths: -------------- branches/rewrite/scripts/basic.py
Added Paths: ----------- branches/rewrite/scripts/i18n/basic.py
Modified: branches/rewrite/scripts/basic.py =================================================================== --- branches/rewrite/scripts/basic.py 2011-01-18 07:13:30 UTC (rev 8855) +++ branches/rewrite/scripts/basic.py 2011-01-18 09:29:12 UTC (rev 8856) @@ -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. # @@ -24,7 +24,7 @@ #
import pywikibot -from pywikibot import pagegenerators +from pywikibot import pagegenerators, i18n
# This is required for the text that is shown when you run this script # with the parameter -help. @@ -33,26 +33,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 must have the same name as the caller + # script (i.e. basic.py in this case)
def __init__(self, generator, dry): """ @@ -67,7 +50,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:
Added: branches/rewrite/scripts/i18n/basic.py =================================================================== --- branches/rewrite/scripts/i18n/basic.py (rev 0) +++ branches/rewrite/scripts/i18n/basic.py 2011-01-18 09:29:12 UTC (rev 8856) @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +msg = { + 'ar': {'basic-changing': {'basic-changing': u'روبوت: تغيير ...', + }, + 'cs': {'basic-changing': u'Robot změnil ...', + }, + 'de': {'basic-changing': u'Bot: Ändere ...', + }, + 'en': {'basic-changing': u'Bot: Changing ...', + }, + 'fa': {'basic-changing': u'ربات: تغییر ...', + }, + 'fr': {'basic-changing': u'Robot: Changé ...', + }, + 'ja': {'basic-changing': u'ロボットによる:編集', + }, + 'ksh': {'basic-changing': u'Bot: Änderung ...', + }, + 'nds': {'basic-changing': u'Bot: Ännern ...', + }, + 'nl': {'basic-changing': u'Bot: wijziging ...', + }, + 'pl': {'basic-changing': u'Bot: zmienia ...', + }, + 'pt': {'basic-changing': u'Bot: alterando...', + }, + 'ru': {'basic-changing': u'Бот: изменил ...', + }, + 'sv': {'basic-changing': u'Bot: Ändrar ...', + }, + 'uk': {'basic-changing': u'Бот: змінив ...', + }, + 'zh': {'basic-changing': u'機器人:編輯.....', +}
Property changes on: branches/rewrite/scripts/i18n/basic.py ___________________________________________________________________ Added: svn:eol-style + native