Revision: 4391 Author: huji Date: 2007-09-30 18:05:16 +0000 (Sun, 30 Sep 2007)
Log Message: -----------
Modified Paths: -------------- branches/pywikipedia/messages/wikipedia.py
Added Paths: ----------- branches/pywikipedia/messages/messages.py
Added: branches/pywikipedia/messages/messages.py =================================================================== --- branches/pywikipedia/messages/messages.py (rev 0) +++ branches/pywikipedia/messages/messages.py 2007-09-30 18:05:16 UTC (rev 4391) @@ -0,0 +1,18 @@ +""" +This file contains the edit summaries used by other modules. +It is imported by wikipedia.py +"""" +edit_summaries = { +'en' : + { + 'test' : u'Adding "test" to the beginning of the page.', + }, +'nl' : + { + 'test' : u'"Test" toegevoegd aan het begin van de pagina.', + } +'fa' : + { + 'test' : u'اضافه کردن «Test» به ابتدای صفحه', + } +} \ No newline at end of file
Property changes on: branches/pywikipedia/messages/messages.py ___________________________________________________________________ Name: svn:eol-style + native
Modified: branches/pywikipedia/messages/wikipedia.py =================================================================== --- branches/pywikipedia/messages/wikipedia.py 2007-09-29 19:49:10 UTC (rev 4390) +++ branches/pywikipedia/messages/wikipedia.py 2007-09-30 18:05:16 UTC (rev 4391) @@ -122,7 +122,7 @@ import re, md5, codecs, difflib, locale import xml.sax, xml.sax.handler import htmlentitydefs -import warnings +import warnings, messages import unicodedata import xmlreader from BeautifulSoup import * @@ -4646,27 +4646,26 @@ the options gives result, we just take the first language in the list. """ + edit_summaries = messages.edit_summaries + # If a site is given instead of a code, use its language if hasattr(code,'lang'): code = code.lang
- #TEMP: Defined messages temporarily here - messages = {'en' : {'test' : u'Test message'}, 'test' : {'test' : u'Maesagi testi'}} - - if messages.has_key(code): - dict = messages[code] + if edit_summaries.has_key(code): + dict = edit_summaries[code] if dict.has_key(msg): return dict[msg] for alt in altlang(code): - if messages.has_key(alt): - dict = messages[alt] + if edit_summaries.has_key(alt): + dict = edit_summaries[alt] if dict.has_key(msg): return dict[msg] - if messages.has_key('en'): - dict = messages['en'] + if edit_summaries.has_key('en'): + dict = edit_summaries['en'] if dict.has_key(msg): return dict[msg] - dict = messages.values()[0] + dict = edit_summaries.values()[0] return dict.values()[0]