Revision: 4401
Author: huji
Date: 2007-10-03 12:52:09 +0000 (Wed, 03 Oct 2007)
Log Message:
-----------
*Changing the order of the nested data in messages.py to make later use of gettext() possible
*changing wikipedia.py and basic.py according to enable easy testing of the code
Modified Paths:
--------------
branches/pywikipedia/messages/basic.py
branches/pywikipedia/messages/messages.py
branches/pywikipedia/messages/wikipedia.py
Modified: branches/pywikipedia/messages/basic.py
===================================================================
--- branches/pywikipedia/messages/basic.py 2007-10-02 21:57:44 UTC (rev 4400)
+++ branches/pywikipedia/messages/basic.py 2007-10-03 12:52:09 UTC (rev 4401)
@@ -43,7 +43,7 @@
def run(self):
# Set the edit summary message
- wikipedia.setAction(wikipedia.translate(wikipedia.getSite(), 'test'))
+ wikipedia.setAction(wikipedia.translate(wikipedia.getSite(), 'Adding "test" to the beginning of the page.'))
for page in self.generator:
self.treat(page)
Modified: branches/pywikipedia/messages/messages.py
===================================================================
--- branches/pywikipedia/messages/messages.py 2007-10-02 21:57:44 UTC (rev 4400)
+++ branches/pywikipedia/messages/messages.py 2007-10-03 12:52:09 UTC (rev 4401)
@@ -1,18 +1,10 @@
"""
This file contains the edit summaries used by other modules.
It is imported by wikipedia.py
-""""
+"""
edit_summaries = {
-'en' :
+ 'Adding "test" to the beginning of the page.':
{
- 'test' : u'Adding "test" to the beginning of the page.',
- },
-'nl' :
- {
- 'test' : u'"Test" toegevoegd aan het begin van de pagina.',
+ 'nl' : (u'"Test" toegevoegd aan het begin van de pagina.'),
}
-'fa' :
- {
- 'test' : u'اضافه کردن «Test» به ابتدای صفحه',
- }
}
\ No newline at end of file
Modified: branches/pywikipedia/messages/wikipedia.py
===================================================================
--- branches/pywikipedia/messages/wikipedia.py 2007-10-02 21:57:44 UTC (rev 4400)
+++ branches/pywikipedia/messages/wikipedia.py 2007-10-03 12:52:09 UTC (rev 4401)
@@ -4652,21 +4652,14 @@
if hasattr(code,'lang'):
code = code.lang
- if edit_summaries.has_key(code):
- dict = edit_summaries[code]
- if dict.has_key(msg):
- return dict[msg]
- for alt in altlang(code):
- if edit_summaries.has_key(alt):
- dict = edit_summaries[alt]
- if dict.has_key(msg):
- return dict[msg]
- if edit_summaries.has_key('en'):
- dict = edit_summaries['en']
- if dict.has_key(msg):
- return dict[msg]
- dict = edit_summaries.values()[0]
- return dict.values()[0]
+ if edit_summaries.has_key(msg):
+ dict = edit_summaries[msg]
+ if dict.has_key(code):
+ return dict[code]
+ for alt in altlang(code):
+ if dict.has_key(alt):
+ return dict[alt]
+ return msg
def showDiff(oldtext, newtext):