Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12321/spambayes

Modified Files:
        i18n.py 
Log Message:
Add a function to load the ui.html file appropriate for the language.

Index: i18n.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/i18n.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** i18n.py     2 Nov 2004 21:27:43 -0000       1.1
--- i18n.py     21 Dec 2004 23:07:17 -0000      1.2
***************
*** 47,50 ****
--- 47,51 ----
  ##       ..etc..
  
+ 
  class LanguageManager:
      def __init__(self, directory=os.path.dirname(__file__)):
***************
*** 90,93 ****
--- 91,112 ----
          lang.install()
  
+     def import_ui_html(self):
+         """Load and return the appropriate ui_html.py module for the
+         current language."""
+         for language in self.current_langs_codes:
+             moduleName = 'languages.%s.i18n_ui_html' % (language, )
+             try:
+                 module = __import__(moduleName, {}, {}, ('languages',
+                                                          language))
+             except ImportError:
+                 # That language isn't available - fall back to the
+                 # next one.
+                 pass
+             else:
+                 return module
+         # Nothing available - use the default.
+         from spambayes.resources import ui_html
+         return ui_html
+ 
      def _install_gettext(self):
          """Set the gettext specific environment."""

_______________________________________________
Spambayes-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/spambayes-checkins

Reply via email to