Revision: 3990 Author: valhallasw Date: 2007-08-07 15:42:17 +0000 (Tue, 07 Aug 2007)
Log Message: ----------- Reverting i18n changes in trunk
Modified Paths: -------------- trunk/pywikipedia/config.py trunk/pywikipedia/selflink.py trunk/pywikipedia/wikipedia.py
Removed Paths: ------------- trunk/pywikipedia/translations/
Modified: trunk/pywikipedia/config.py =================================================================== --- trunk/pywikipedia/config.py 2007-08-07 15:28:37 UTC (rev 3989) +++ trunk/pywikipedia/config.py 2007-08-07 15:42:17 UTC (rev 3990) @@ -85,8 +85,6 @@ # tkinter isn't yet ready userinterface = 'terminal'
-userinterface_lang = None - # What color should we used for text? This should match your # operating system's default color for console text. # Note: This setting is only required for Windows users.
Modified: trunk/pywikipedia/selflink.py =================================================================== --- trunk/pywikipedia/selflink.py 2007-08-07 15:28:37 UTC (rev 3989) +++ trunk/pywikipedia/selflink.py 2007-08-07 15:42:17 UTC (rev 3990) @@ -36,6 +36,8 @@ }
# Summary messages in different languages +# NOTE: Predefined replacement tasks might use their own dictionary, see 'fixes' +# below. msg = { 'de':u'Bot: Entferne Selbstlinks', 'en':u'Robot: Removing selflinks', @@ -108,13 +110,13 @@ # at the end of the link, reset the color to default colors = [None for c in text[max(0, match.start() - context) : match.start()]] + [12 for c in text[match.start() : match.end()]] + [None for c in text[match.end() : match.end() + context]] wikipedia.output(text[max(0, match.start() - context) : match.end() + context], colors = colors) - choice = wikipedia.inputChoice(_(u'\nWhat shall be done with this selflink?'), [_('unlink'), _('make bold'), _('skip'), _('edit'), _('more context')], [_('u [unlink hotkey]'), _('b [make bold hotkey]'), _('s [skip hotkey]'), _('e [edit hotkey]'), _('m [more context hotkey]')], _('u [unlink hotkey]')) + choice = wikipedia.inputChoice(u'\nWhat shall be done with this selflink?', ['unlink', 'make bold', 'skip', 'edit', 'more context'], ['U', 'b', 's', 'e', 'm'], 'u') wikipedia.output(u'')
- if choice == _('s [skip hotkey]'): + if choice == 's': # skip this link return text, False - elif choice == _('e [edit hotkey]'): + elif choice == 'e': editor = editarticle.TextEditor() newText = editor.edit(text, jumpIndex = match.start()) # if user didn't press Cancel @@ -122,13 +124,13 @@ return newText, True else: return text, True - elif choice == _('m [more context hotkey]'): + elif choice == 'm': # show more context by recursive self-call return self.handleNextLink(page, text, match, context = context + 100) else: new = match.group('label') or match.group('title') new += match.group('linktrail') - if choice == _('u [unlink hotkey]'): + if choice == 'u': return text[:match.start()] + new + text[match.end():], False else: # make bold @@ -154,16 +156,16 @@ curpos = 0
if oldText == text: - wikipedia.output(_(u'No changes necessary.')) + wikipedia.output(u'No changes necessary.') else: wikipedia.showDiff(oldText, text) page.put(text) except wikipedia.NoPage: - wikipedia.output(_(u"Page %s does not exist; skipping.") % page.aslink()) + wikipedia.output(u"Page %s does not exist?!" % page.aslink()) except wikipedia.IsRedirectPage: - wikipedia.output(_(u"Page %s is a redirect; skipping.") % page.aslink()) + wikipedia.output(u"Page %s is a redirect; skipping." % page.aslink()) except wikipedia.LockedPage: - wikipedia.output(_(u"Page %s is locked; skipping.") % page.aslink()) + wikipedia.output(u"Page %s is locked?!" % page.aslink())
def run(self): comment = wikipedia.translate(wikipedia.getSite(), msg) @@ -189,7 +191,7 @@ for arg in wikipedia.handleArgs(): if arg.startswith('-xml'): if len(arg) == 4: - xmlFilename = wikipedia.input(_(u'Please enter the XML dump's filename:')) + xmlFilename = wikipedia.input(u'Please enter the XML dump's filename:') else: xmlFilename = arg[5:] gen = XmlDumpSelflinkPageGenerator(xmlFilename)
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2007-08-07 15:28:37 UTC (rev 3989) +++ trunk/pywikipedia/wikipedia.py 2007-08-07 15:42:17 UTC (rev 3990) @@ -118,12 +118,11 @@ import traceback import time, threading, Queue import math -import re, md5, codecs, difflib +import re, md5, codecs, difflib, locale import xml.sax, xml.sax.handler import htmlentitydefs import warnings import unicodedata -import gettext, locale
import config, login import xmlreader @@ -549,7 +548,7 @@ isWatched = False editRestriction = None if verbose: - output(_(u'Getting page %s') % self.aslink()) + output(u'Getting page %s' % self.aslink()) path = self.site().edit_address(self.urlname()) if oldid: path = path + "&oldid="+oldid @@ -1151,9 +1150,9 @@ predata['masteredit'] = '1'
if newPage: - output(_(u'Creating page %s...') % self.aslink(forceInterwiki=True)) + output(u'Creating page %s' % self.aslink(forceInterwiki=True)) else: - output(_(u'Changing page %s...') % self.aslink(forceInterwiki=True)) + output(u'Changing page %s' % self.aslink(forceInterwiki=True)) # Submit the prepared information if self.site().hostname() in config.authenticate.keys(): predata.append(("Content-type","application/x-www-form-urlencoded")) @@ -2316,7 +2315,7 @@ return data
def getall(site, pages, throttle = True, force = False): - output(_(u'Getting %i pages from %s...') % (len(pages), site)) + output(u'Getting %d pages from %s...' % (len(pages), site)) return GetAll(site, pages, throttle, force).run()
# Library functions @@ -2411,7 +2410,7 @@ f.write(str(p)+' '+str(processes[p])+'\n') f.close() self.process_multiplicity = count - output(_(u"Checked for running processes. %i processes currently running, including the current process.") % count) + output(u"Checked for running processes. %s processes currently running, including the current process." % count) finally: self.lock.release()
@@ -3180,7 +3179,7 @@ """ self._loadCookies(sysop = sysop) if not self.loginStatusKnown: - output(_(u'Getting a page to check if we're logged in on %s...') % self) + output(u'Getting a page to check if we're logged in on %s' % self) path = self.put_address('Non-existing_page') text = self.getUrl(path, sysop = sysop) # Search for the "my talk" link at the top @@ -3191,7 +3190,7 @@ self._loggedInAs = m.group('username') # While we're at it, check if we have got unread messages if '<div class="usermessage">' in text: - output(_(u'NOTE: You have unread messages on %s') % self) + output(u'NOTE: You have unread messages on %s' % self) messages=True else: messages=False @@ -4216,8 +4215,6 @@ """) sys.exit(1)
-ui_langs = [(config.userinterface_lang or config.mylang), 'en'] -gettext.translation(domain = 'pywikipedia', localedir = _wt.absoluteFilename('translations'), languages = ui_langs).install(unicode = True)
# Languages to use for comment text after the actual language but before # en:. For example, if for language 'xx', you want the preference of
pywikipedia-l@lists.wikimedia.org