|
1 | | -# $Id: client.py,v 1.181 2004-07-02 05:22:09 richard Exp $ |
| 1 | +# $Id: client.py,v 1.182 2004-07-11 14:23:12 a1s Exp $ |
2 | 2 |
|
3 | 3 | """WWW request handler (also used in the stand-alone server). |
4 | 4 | """ |
|
10 | 10 |
|
11 | 11 |
|
12 | 12 | from roundup import roundupdb, date, hyperdb, password |
13 | | -from roundup.cgi import templating, cgitb |
| 13 | +from roundup.cgi import templating, cgitb, TranslationService |
14 | 14 | from roundup.cgi.actions import * |
15 | 15 | from roundup.cgi.exceptions import * |
16 | 16 | from roundup.cgi.form_parser import FormParser |
@@ -60,6 +60,7 @@ class Client: |
60 | 60 | - "additional_headers" is a dictionary of additional HTTP headers that |
61 | 61 | should be sent to the client |
62 | 62 | - "response_code" is the HTTP response code to send to the client |
| 63 | + - "translator" is TranslationService instance |
63 | 64 |
|
64 | 65 | During the processing of a request, the following attributes are used: |
65 | 66 |
|
@@ -156,14 +157,14 @@ def setTranslator(self, translator=None): |
156 | 157 | """Replace the translation engine |
157 | 158 |
|
158 | 159 | 'translator' |
159 | | - is i18n module or one of gettext translation classes. |
160 | | - It must have attributes 'gettext' and 'ngettext', |
161 | | - serving as translation functions. |
| 160 | + is TranslationService instance. |
| 161 | + It must define methods 'translate' (TAL-compatible i18n), |
| 162 | + 'gettext' and 'ngettext' (gettext-compatible i18n). |
162 | 163 |
|
163 | | - If omitted, use templating.translationService. |
| 164 | + If omitted, create default TranslationService. |
164 | 165 | """ |
165 | 166 | if translator is None: |
166 | | - translator = templating.translationService |
| 167 | + translator = TranslationService.get_translation() |
167 | 168 | self.translator = translator |
168 | 169 | self._ = self.gettext = translator.gettext |
169 | 170 | self.ngettext = translator.ngettext |
|
0 commit comments