Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14133/scripts
Modified Files:
sb_server.py
Log Message:
Add i18n support.
Index: sb_server.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_server.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** sb_server.py 20 Dec 2004 23:24:03 -0000 1.33
--- sb_server.py 21 Dec 2004 23:13:47 -0000 1.34
***************
*** 55,58 ****
--- 55,66 ----
True, False = 1, 0
+ try:
+ reversed
+ except NameError:
+ # Maintain compatibility with Python 2.2 and 2.3
+ def reversed(seq):
+ seq = list(seq[:])
+ seq.reverse()
+ return iter(seq)
todo = """
***************
*** 102,105 ****
--- 110,114 ----
import spambayes.message
+ from spambayes import i18n
from spambayes import Dibbler
from spambayes import storage
***************
*** 111,114 ****
--- 120,124 ----
from spambayes.Version import get_version_string
+
# Increase the stack size on MacOS X. Stolen from Lib/test/regrtest.py
if sys.platform == 'darwin':
***************
*** 652,655 ****
--- 662,681 ----
def init(self):
assert not self.prepared, "init after prepare, but before close"
+ # Load the environment for translation.
+ self.lang_manager = i18n.LanguageManager()
+ # Set the system user default language.
+ self.lang_manager.set_language(\
+ self.lang_manager.locale_default_lang())
+ # Set interface to use the user language in the configuration file.
+ for language in reversed(options["globals", "language"]):
+ # We leave the default in there as the last option, to fall
+ # back on if necessary.
+ self.lang_manager.add_language(language)
+ if options["globals", "verbose"]:
+ print "Asked to add languages: " + \
+ ", ".join(options["globals", "language"])
+ print "Set language to " + \
+ str(self.lang_manager.current_langs_codes)
+
# Open the log file.
if options["globals", "verbose"]:
_______________________________________________
Spambayes-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/spambayes-checkins