http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10271
Revision: 10271 Author: xqt Date: 2012-06-02 23:01:31 +0000 (Sat, 02 Jun 2012) Log Message: ----------- i18n support
Modified Paths: -------------- trunk/pywikipedia/spellcheck.py
Modified: trunk/pywikipedia/spellcheck.py =================================================================== --- trunk/pywikipedia/spellcheck.py 2012-06-02 22:59:16 UTC (rev 10270) +++ trunk/pywikipedia/spellcheck.py 2012-06-02 23:01:31 UTC (rev 10271) @@ -51,7 +51,7 @@ """ # # (C) Andre Engels, 2005 -# (C) Pywikipedia bot team, 2006-2011 +# (C) Pywikipedia bot team, 2006-2012 # # Distributed under the terms of the MIT license. # @@ -61,27 +61,14 @@ import re, sys import string, codecs import wikipedia as pywikibot +from pywikibot import i18n import pagegenerators
-msg={ - 'ar': u'تدقيق إملائي بمساعدة البوت', - 'de': u'Bot-unterstützte Rechtschreibprüfung', - 'en': u'Bot-aided spell checker', - 'es': u'Bot asistido de correción ortográfica', - 'fr': u'Correction orthographique par robot', - 'he': u'בדיקת איות באמצעות בוט', - 'ia': u'Correction de orthographia per robot', - 'nl': u'Spellingscontrole', - 'pl': u'Wspomagane przez robota sprawdzanie pisowni', - 'pt': u'Bot de correção ortográfica', -}
- class SpecialTerm(object): def __init__(self, text): self.style = text
- def distance(a,b): # Calculates the Levenshtein distance between a and b. # That is, the number of edits needed to change one into @@ -428,7 +415,8 @@ else: text = spellcheck(text, checknames=checknames, knownonly=knownonly, title=page.title()) if text != page.get(): - page.put(text) + summary = i18n.twtranslate(page.site, 'spellcheck-checking') + page.put(text, summary)
try: pageskip = [] @@ -471,7 +459,6 @@ mysite = pywikibot.getSite() if not checklang: checklang = mysite.language() - pywikibot.setAction(pywikibot.translate(mysite,msg)) filename = pywikibot.config.datafilepath('spelling', 'spelling-' + checklang + '.txt') print "Getting wordlist"