http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9342
Revision: 9342
Author: xqt
Date: 2011-07-09 11:58:44 +0000 (Sat, 09 Jul 2011)
Log Message:
-----------
i18n tw support for cosmetic changes
Modified Paths:
--------------
trunk/pywikipedia/cosmetic_changes.py
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/cosmetic_changes.py
===================================================================
--- trunk/pywikipedia/cosmetic_changes.py 2011-07-09 11:53:18 UTC (rev 9341)
+++ trunk/pywikipedia/cosmetic_changes.py 2011-07-09 11:58:44 UTC (rev 9342)
@@ -53,6 +53,7 @@
import wikipedia as pywikibot
import isbn
import pagegenerators
+from pywikibot import i18n
import sys
import re
@@ -66,167 +67,6 @@
'&warning;': warning,
}
-# Summary message when using this module as a stand-alone script
-msg_standalone = {
- 'commons': u'Bot: [[Commons talk:Tools/pywiki file description
cleanup|desc page fmt]]',
- 'af': u'Robot: Kosmetiese veranderinge',
- 'als': u'Bötli: chleineri Änderige',
- 'ar': u'روبوت: تغييرات تجميلية',
- 'ast': u'Robot: Cambéos cosméticos',
- 'az': u'Robot: Kosmetik dəyişmələr',
- 'be-tarask': u'Робат: касмэтычныя зьмены',
- 'be-x-old': u'Робат: касмэтычныя зьмены',
- 'bg': u'Робот козметични промени',
- 'bn': u'বট: কসমেটিক পরিবর্তন',
- 'br': u'Bot: Kemm dister',
- 'bs': u'Robot: kozmetičke promjene',
- 'ca': u'Robot: Canvis cosmètics',
- 'ckb': u'بۆت: دەستکاریی جوانکاری',
- 'cs': u'Robotické: kosmetické úpravy',
- 'da': u'Bot: Kosmetiske ændringer',
- 'de': u'Bot: Kosmetische Änderungen',
- 'el': u'Ρομπότ: διακοσμητικές αλλαγές',
- 'en': u'Robot: Cosmetic changes',
- 'es': u'Robot: Cambios triviales',
- 'et': u'robot: kosmeetilised muudatused',
- 'eu': u'Robota: Aldaketa kosmetikoak',
- 'fa': u'ربات: زیباسازی',
- 'fi': u'Botti kosmeettisia muutoksia',
- 'fr': u'Robot : Changement de type cosmétique',
- 'frr': u'Bot: Kosmeetisk feranerangen',
- 'fy': u'bot tekstwiziging',
- 'ga': u'Róbat: Athruithe cosmaideacha',
- 'gl': u'bot Cambios estética',
- 'he': u'בוט: שינויים קוסמטיים',
- 'hi': u'Bot: अंगराग परिवर्तन',
- 'hr': u'robot kozmetičke promjene',
- 'hsb': u'Bot: Kosmetiske změny',
- 'hu': u'Bot: kozmetikai változtatások',
- 'ia': u'Robot: Cambios cosmetic',
- 'id': u'bot kosmetik perubahan',
- 'it': u'Bot: Modifiche estetiche',
- 'ja': u'ロボットによる: 細部の編集',
- 'ko': u'로봇: 예쁘게 바꿈',
- 'ksh': u'Bot: Änderonge för de Schönheit',
- 'la': u'automaton: mutationes minores',
- 'lb': u'Bot: Kosmetesch Ännerungen',
- 'li': u'Robot: cosmetische verangeringe',
- 'lt': u'robotas: smulkūs taisymai',
- 'lv': u'robots kosmētiskās izmaiņas',
- 'mk': u'Бот: козметички промени',
- 'ms': u'Bot: perubahan kosmetik',
- 'mt': u'Bot: kosmetiċi bidliet',
- 'nds': u'Bot: kosmeetsch Ännern',
- 'nl': u'Robot: cosmetische wijzigingen',
- 'nn': u'Robot: Kosmetiske endringar',
- 'no': u'Bot: Kosmetiske endringer',
- 'pdc': u'Waddefresser: gleenere Enneringe',
- 'pfl': u'Bot: Klännere Ännerunge',
- 'pl': u'Robot dokonuje poprawek kosmetycznych',
- 'pt': u'Robô: Mudanças triviais',
- 'ro': u'robot modificări cosmetice',
- 'ru': u'робот косметические изменения',
- 'sk': u'robot kozmetické zmeny',
- 'sl': u'robot kozmetične spremembe',
- 'sr': u'Робот: козметичке измене',
- 'sv': u'Bot: Kosmetiska ändringar',
- 'ta': u'தானியங்கி: மேலோட்டமான மாற்றங்கள்',
- 'te': u'బాటు: పైపై మార్పులు',
- 'th': u'บอต ปรับแต่งให้อ่านง่าย',
- 'tk': u'Bot: kosmetik üýtgeşme',
- 'tl': u'robot Kosmetiko pagbabago',
- 'tr': u'Bot Kozmetik değişiklikler',
- 'tt': u'Робот: Косметик үзгәртүләр',
- 'uk': u'робот косметичні зміни',
- 'vec': u'Bot: Modifiche estetiche',
- 'vi': u'Bot: Sửa cách trình bày',
- 'war': u'Robot: Kosmetiko nga mga pagbag-o',
- 'yi': u'באט: קאסמעטישע ענדערונגען',
- 'zh': u'機器人: 細部更改',
- 'zh-hans': u'机器人: 化妆品的变化',
-}
-
-# Summary message that will be appended to the normal message when
-# cosmetic changes are made on the fly
-msg_append = {
- 'commons': u'; [[Commons talk:Tools/pywiki file description cleanup|desc
page fmt]]',
- 'af': u'; kosmetiese veranderinge',
- 'als': u'; chleineri Änderige',
- 'ar': u'; تغييرات تجميلية',
- 'ast': u'; cambéos cosméticos',
- 'az': u'; kosmetik dəyişmələr',
- 'be': u'; дробныя змены',
- 'be-x-old': u'; касмэтычныя зьмены',
- 'bg': u'; козметични промени',
- 'bn': u'; কসমেটিক পরিবর্তন',
- 'br': u'; Kemm dister',
- 'bs': u'; kozmetičke promjene',
- 'ca': u'; canvis cosmètics',
- 'ckb': u'; دەستکاریی جوانکاری',
- 'cs': u'; kosmetické úpravy',
- 'da': u'; kosmetiske ændringer',
- 'de': u'; kosmetische Änderungen',
- 'el': u'; διακοσμητικές αλλαγές',
- 'en': u'; cosmetic changes',
- 'es': u'; cambios triviales',
- 'et': u'; kosmeetilised muudatused',
- 'eu': u'; aldaketa kosmetikoak',
- 'fa': u'; زیباسازی',
- 'fi': u'; kosmeettisia muutoksia',
- 'fr': u'; changement de type cosmétique',
- 'frr': u'; kosmeetisk feranerangen',
- 'fy': u'; tekstwiziging',
- 'ga': u'; athruithe cosmaideacha',
- 'gl': u'; cambios estética',
- 'he': u'; שינויים קוסמטיים',
- 'hi': u'; अंगराग परिवर्तन',
- 'hr': u'; kozmetičke promjene',
- 'hsb': u'; kosmetiske změny',
- 'hu': u'; kozmetikai változtatások',
- 'ia': u'; cambios cosmetic',
- 'id': u'; kosmetik perubahan',
- 'it': u'; modifiche estetiche',
- 'ja': u'; 細部の編集',
- 'ko': u'; 예쁘게 바꿈',
- 'ksh': u'; Änderonge för de Schönheit',
- 'la': u'; mutationes minores',
- 'lb': u'; kosmetesch Ännerungen',
- 'li': u'; cosmetische verangeringe',
- 'lt': u'; smulkūs taisymai',
- 'lv': u'; kosmētiskās izmaiņas',
- 'mk': u'; козметички промени',
- 'ms': u'; perubahan kosmetik',
- 'mt': u'; kosmetiċi bidliet',
- 'nds': u'; kosmeetsch Ännern',
- 'nl': u'; cosmetische veranderingen',
- 'nn': u'; kosmetiske endringar',
- 'no': u'; kosmetiske endringer',
- 'pdc': u'; gleenere Enneringe',
- 'pfl': u'; klännere Ännerunge',
- 'pl': u'; zmiany kosmetyczne',
- 'pt': u'; mudanças triviais',
- 'ro': u'; modificări cosmetice',
- 'ru': u'; косметические изменения',
- 'sk': u'; kozmetické zmeny',
- 'sl': u'; kozmetične spremembe',
- 'sr': u'; козметичке измене',
- 'sv': u'; kosmetiska ändringar',
- 'ta': u'; மேலோட்டமான மாற்றங்கள்',
- 'te': u'; పైపై మార్పులు',
- 'th': u'; ปรับแต่งให้อ่านง่าย',
- 'tk': u'; kosmetik üýtgeşme',
- 'tl': u'; Kosmetiko pagbabago',
- 'tr': u'; Kozmetik değişiklikler',
- 'tt': u'; косметик үзгәртүләр',
- 'uk': u'; косметичні зміни',
- 'vec': u'; modifiche estetiche',
- 'vi': u'; sửa cách trình bày',
- 'war': u'; kosmetiko nga mga pagbag-o',
- 'yi': u'; קאסמעטישע ענדערונגען',
- 'zh': u'; 細部更改',
- 'zh-hans': u';化妆品的变化',
-}
-
nn_iw_msg = u'<!--interwiki (no, sv, da first; then other languages alphabetically
by name)-->'
# This is from interwiki.py;
@@ -914,7 +754,8 @@
if editSummary == '':
# Load default summary message.
- editSummary = pywikibot.translate(pywikibot.getSite(), msg_standalone)
+ editSummary = i18n.twtranslate(pywikibot.getSite(),
+ 'cosmetic_changes-standalone')
if pageTitle:
site = pywikibot.getSite()
page = pywikibot.Page(site, ' '.join(pageTitle))
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2011-07-09 11:53:18 UTC (rev 9341)
+++ trunk/pywikipedia/wikipedia.py 2011-07-09 11:58:44 UTC (rev 9342)
@@ -1737,10 +1737,11 @@
if verbose:
output(u'Cosmetic Changes for %s-%s enabled.' %
(self.site().family.name, self.site().lang))
import cosmetic_changes
+ from pywikibot import i18n
ccToolkit = cosmetic_changes.CosmeticChangesToolkit(self.site(),
redirect=self.isRedirectPage(), namespace = self.namespace(), pageTitle=self.title())
newtext = ccToolkit.change(newtext)
if comment and old.strip().replace('\r\n', '\n') !=
newtext.strip().replace('\r\n', '\n'):
- comment += translate(self.site(), cosmetic_changes.msg_append)
+ comment += i18n.twtranslate(self.site(),
'cosmetic_changes-append')
if watchArticle is None:
# if the page was loaded via get(), we know its status