http://www.mediawiki.org/wiki/Special:Code/pywikipedia/8859
Revision: 8859
Author: xqt
Date: 2011-01-18 19:37:47 +0000 (Tue, 18 Jan 2011)
Log Message:
-----------
i18n for replace.py
Modified Paths:
--------------
branches/rewrite/scripts/replace.py
Added Paths:
-----------
branches/rewrite/scripts/i18n/replace.py
Added: branches/rewrite/scripts/i18n/replace.py
===================================================================
--- branches/rewrite/scripts/i18n/replace.py (rev 0)
+++ branches/rewrite/scripts/i18n/replace.py 2011-01-18 19:37:47 UTC (rev
8859)
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+msg = {
+ 'ar': {'replace-replacing': u'%(description)s روبوت : استبدال تلقائي للنص',
+ },
+ 'ca': {'replace-replacing': u'Robot: Reemplaçament automàtic de text
%(description)s',
+ },
+ 'cs': {'replace-replacing': u'Robot automaticky nahradil text:
%(description)s',
+ },
+ 'de': {'replace-replacing': u'Bot: Automatisierte Textersetzung
%(description)s',
+ },
+ 'el': {'replace-replacing': u'Ρομπότ: Αυτόματη αντικατάσταση κειμένου
%(description)s',
+ },
+ 'en': {'replace-replacing': u'Bot: Automated text replacement
%(description)s',
+ },
+ 'es': {'replace-replacing': u'Robot: Reemplazo automático de texto
%(description)s',
+ },
+ 'fa': {'replace-replacing': u'ربات: تغییر خودکار متن %(description)s',
+ },
+ 'fi': {'replace-replacing': u'Botti korvasi automaattisesti tekstin
%(description)s',
+ },
+ 'fr': {'replace-replacing': u'Robot : Remplacement de texte automatisé
%(description)s',
+ },
+ 'frr': {'replace-replacing': u'Bot: Automatisiaret ütjwakselt tekst
%(description)s',
+ },
+ 'he': {'replace-replacing': u'בוט: החלפת טקסט אוטומטית %(description)s',
+ },
+ 'hu': {'replace-replacing': u'Robot: Automatikus szövegcsere
%(description)s',
+ },
+ 'ia': {'replace-replacing': u'Robot: Reimplaciamento automatic de texto
%(description)s',
+ },
+ 'id': {'replace-replacing': u'Bot: Penggantian teks otomatis
%(description)s',
+ },
+ 'is': {'replace-replacing': u'Vélmenni: breyti texta %(description)s',
+ },
+ 'it': {'replace-replacing': u'Bot: Sostituzione automatica
%(description)s',
+ },
+ 'ja': {'replace-replacing': u'ロボットによる: 文字置き換え %(description)s',
+ },
+ 'ka': {'replace-replacing': u'რობოტი: ტექსტის ავტომატური შეცვლა
%(description)s',
+ },
+ 'kk': {'replace-replacing': u'Бот: Мәтінді өздікті алмастырды:
%(description)s',
+ },
+ 'ksh': {'replace-replacing': u'Bot: hät outomatesch Täx jetuusch:
%(description)s',
+ },
+ 'lt': {'replace-replacing': u'robotas: Automatinis teksto keitimas
%(description)s',
+ },
+ 'nds': {'replace-replacing': u'Bot: Text automaatsch utwesselt:
%(description)s',
+ },
+ 'nds-nl': {'replace-replacing': u'Bot: autematisch tekse vervungen
%(description)s',
+ },
+ 'nl': {'replace-replacing': u'Bot: automatisch tekst vervangen
%(description)s',
+ },
+ 'nn': {'replace-replacing': u'robot: automatisk teksterstatning:
%(description)s',
+ },
+ 'no': {'replace-replacing': u'robot: automatisk teksterstatning:
%(description)s',
+ },
+ 'pl': {'replace-replacing': u'Robot automatycznie zamienia tekst
%(description)s',
+ },
+ 'pt': {'replace-replacing': u'Bot: Mudança automática %(description)s',
+ },
+ 'ru': {'replace-replacing': u'Робот: Автоматизированная замена текста
%(description)s',
+ },
+ 'sr': {'replace-replacing': u'Бот: Аутоматска замена текста
%(description)s',
+ },
+ 'sv': {'replace-replacing': u'Bot: Automatisk textersättning:
%(description)s',
+ },
+ 'uk': {'replace-replacing': u'Бот: Автоматизована заміна тексту:
%(description)s',
+ },
+ 'zh': {'replace-replacing': u'機器人:執行文字代換作業 %(description)s',
+ },
+}
Modified: branches/rewrite/scripts/replace.py
===================================================================
--- branches/rewrite/scripts/replace.py 2011-01-18 09:54:40 UTC (rev 8858)
+++ branches/rewrite/scripts/replace.py 2011-01-18 19:37:47 UTC (rev 8859)
@@ -125,6 +125,7 @@
from pywikibot import pagegenerators
from scripts import editarticle
from pywikibot import catlib, config
+from pywikibot import i18n
import webbrowser
# Imports predefined replacements tasks from fixes.py
@@ -138,47 +139,6 @@
}
-# Summary messages in different languages
-# NOTE: Predefined replacement tasks might use their own dictionary, see
'fixes'
-# below.
-msg = {
- 'ar': u'%s روبوت : استبدال تلقائي للنص',
- 'ca': u'Robot: Reemplaçament automàtic de text %s',
- 'cs': u'Robot automaticky nahradil text: %s',
- 'de': u'Bot: Automatisierte Textersetzung %s',
- 'el': u'Ρομπότ: Αυτόματη αντικατάσταση κειμένου %s',
- 'en': u'Bot: Automated text replacement %s',
- 'es': u'Robot: Reemplazo automático de texto %s',
- 'fa': u'ربات: تغییر خودکار متن %s',
- 'fi': u'Botti korvasi automaattisesti tekstin %s',
- 'fr': u'Robot : Remplacement de texte automatisé %s',
- 'frr': u'Bot: Automatisiaret ütjwakselt tekst %s',
- 'he': u'בוט: החלפת טקסט אוטומטית %s',
- 'hu': u'Robot: Automatikus szövegcsere %s',
- 'ia': u'Robot: Reimplaciamento automatic de texto %s',
- 'id': u'Bot: Penggantian teks otomatis %s',
- 'is': u'Vélmenni: breyti texta %s',
- 'it': u'Bot: Sostituzione automatica %s',
- 'ja': u'ロボットによる: 文字置き換え %s',
- 'ka': u'რობოტი: ტექსტის ავტომატური შეცვლა %s',
- 'kk': u'Бот: Мәтінді өздікті алмастырды: %s',
- 'ksh': u'Bot: hät outomatesch Täx jetuusch: %s',
- 'lt': u'robotas: Automatinis teksto keitimas %s',
- 'nds': u'Bot: Text automaatsch utwesselt: %s',
- 'nds-nl': u'Bot: autematisch tekse vervungen %s',
- 'nl': u'Bot: automatisch tekst vervangen %s',
- 'nn': u'robot: automatisk teksterstatning: %s',
- 'no': u'robot: automatisk teksterstatning: %s',
- 'pl': u'Robot automatycznie zamienia tekst %s',
- 'pt': u'Bot: Mudança automática %s',
- 'ru': u'Робот: Автоматизированная замена текста %s',
- 'sr': u'Бот: Аутоматска замена текста %s',
- 'sv': u'Bot: Automatisk textersättning: %s',
- 'uk': u'Бот: Автоматизована заміна тексту: %s',
- 'zh': u'機器人:執行文字代換作業 %s',
-}
-
-
class XmlDumpReplacePageGenerator:
"""
Iterator that will yield Pages that might contain text to replace.
@@ -581,10 +541,11 @@
replacements.append((commandline_replacements[0],
commandline_replacements[1]))
if not summary_commandline:
- edit_summary = pywikibot.translate(pywikibot.getSite(), msg
- ) % (' (-' + commandline_replacements[0]
- + ' +' + commandline_replacements[1]
- + ')')
+ edit_summary = i18n.twtranslate(pywikibot.getSite(),
+ 'replace-replacing',
+ {'description': ' (-%s +%s)'
+ % (commandline_replacements[0],
+ commandline_replacements[1])})
elif (len(commandline_replacements) > 1):
if (fix == None):
for i in xrange (0, len(commandline_replacements), 2):
@@ -596,8 +557,10 @@
for i in range(0, len(commandline_replacements), 2)]
replacementsDescription = '(%s)' % ', '.join(
[('-' + pair[0] + ' +' + pair[1]) for pair in pairs])
- edit_summary = pywikibot.translate(pywikibot.getSite(), msg
- ) % replacementsDescription
+ edit_summary = i18n.twtranslate(pywikibot.getSite(),
+ 'replace-replacing',
+ {'description':
+ replacementsDescription})
else:
raise pywikibot.Error(
'Specifying -fix with replacements is undefined')
@@ -610,14 +573,15 @@
old = pywikibot.input(
u'Please enter another text that should be replaced, or press Enter to start:')
if old == '':
- change = change + ')'
+ change += ')'
break
new = pywikibot.input(u'Please enter the new text:')
- change = change + ' & -' + old + ' +' + new
+ change += ' & -' + old + ' +' + new
replacements.append((old, new))
if not summary_commandline:
- default_summary_message = pywikibot.translate(
- pywikibot.getSite(), msg) % change
+ default_summary_message = i18n.twtranslate(pywikibot.getSite(),
+ 'replace-replacing',
+ {'description': change})
pywikibot.output(u'The summary message will default to: %s'
% default_summary_message)
summary_message = pywikibot.input(
_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn