diff roundup/cgi/client.py @ 2557:ff02e9851592

translator object must be Roundup Translation Service... ...providing both TAL and gettext translation API; if no explicit translator given, get the service object from lookup function, not from the obsolescent global variable
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Sun, 11 Jul 2004 14:23:12 +0000
parents 091711fb2f8c
children 89c5e8564dad
line wrap: on
line diff
--- a/roundup/cgi/client.py	Sun Jul 11 14:17:17 2004 +0000
+++ b/roundup/cgi/client.py	Sun Jul 11 14:23:12 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: client.py,v 1.181 2004-07-02 05:22:09 richard Exp $
+# $Id: client.py,v 1.182 2004-07-11 14:23:12 a1s Exp $
 
 """WWW request handler (also used in the stand-alone server).
 """
@@ -10,7 +10,7 @@
 
 
 from roundup import roundupdb, date, hyperdb, password
-from roundup.cgi import templating, cgitb
+from roundup.cgi import templating, cgitb, TranslationService
 from roundup.cgi.actions import *
 from roundup.cgi.exceptions import *
 from roundup.cgi.form_parser import FormParser
@@ -60,6 +60,7 @@
     - "additional_headers" is a dictionary of additional HTTP headers that
       should be sent to the client
     - "response_code" is the HTTP response code to send to the client
+    - "translator" is TranslationService instance
 
     During the processing of a request, the following attributes are used:
 
@@ -156,14 +157,14 @@
         """Replace the translation engine
 
         'translator'
-           is i18n module or one of gettext translation classes.
-           It must have attributes 'gettext' and 'ngettext',
-           serving as translation functions.
+           is TranslationService instance.
+           It must define methods 'translate' (TAL-compatible i18n),
+           'gettext' and 'ngettext' (gettext-compatible i18n).
 
-           If omitted, use templating.translationService.
+           If omitted, create default TranslationService.
         """
         if translator is None:
-            translator = templating.translationService
+            translator = TranslationService.get_translation()
         self.translator = translator
         self._ = self.gettext = translator.gettext
         self.ngettext = translator.ngettext

Roundup Issue Tracker: http://roundup-tracker.org/