Skip to content

Commit 2c7572e

Browse files
author
Alexander Smishlajev
committed
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
1 parent 0cc33fb commit 2c7572e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

roundup/cgi/client.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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 $
22

33
"""WWW request handler (also used in the stand-alone server).
44
"""
@@ -10,7 +10,7 @@
1010

1111

1212
from roundup import roundupdb, date, hyperdb, password
13-
from roundup.cgi import templating, cgitb
13+
from roundup.cgi import templating, cgitb, TranslationService
1414
from roundup.cgi.actions import *
1515
from roundup.cgi.exceptions import *
1616
from roundup.cgi.form_parser import FormParser
@@ -60,6 +60,7 @@ class Client:
6060
- "additional_headers" is a dictionary of additional HTTP headers that
6161
should be sent to the client
6262
- "response_code" is the HTTP response code to send to the client
63+
- "translator" is TranslationService instance
6364
6465
During the processing of a request, the following attributes are used:
6566
@@ -156,14 +157,14 @@ def setTranslator(self, translator=None):
156157
"""Replace the translation engine
157158
158159
'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).
162163
163-
If omitted, use templating.translationService.
164+
If omitted, create default TranslationService.
164165
"""
165166
if translator is None:
166-
translator = templating.translationService
167+
translator = TranslationService.get_translation()
167168
self.translator = translator
168169
self._ = self.gettext = translator.gettext
169170
self.ngettext = translator.ngettext

0 commit comments

Comments
 (0)