1414# Modifications for Roundup:
1515# 1. implemented ustr as str
1616# 2. make imports use roundup.cgi
17- # 3. added StaticTranslationService
1817"""Global Translation Service for providing I18n to Page Templates.
1918
20- $Id: GlobalTranslationService.py,v 1.3 2004-05-23 13:05:43 a1s Exp $
19+ $Id: GlobalTranslationService.py,v 1.4 2004-05-29 00:08:07 a1s Exp $
2120"""
2221
2322import re
2423
25- from roundup import i18n
26-
2724from roundup .cgi .TAL .TALDefs import NAME_RE
2825
2926ustr = str
@@ -32,38 +29,13 @@ class DummyTranslationService:
3229 """Translation service that doesn't know anything about translation."""
3330 def translate (self , domain , msgid , mapping = None ,
3431 context = None , target_language = None , default = None ):
35- return str (msgid ).upper ()
3632 def repl (m , mapping = mapping ):
3733 return ustr (mapping [m .group (m .lastindex )])
3834 cre = re .compile (r'\$(?:(%s)|\{(%s)\})' % (NAME_RE , NAME_RE ))
3935 return cre .sub (repl , default or msgid )
4036 # XXX Not all of Zope.I18n.ITranslationService is implemented.
4137
42- class StaticTranslationService :
43-
44- """Translation service for application default language
45-
46- This service uses "static" translation, with single domain
47- and target language, initialized from OS environment when
48- roundup.i18n is loaded.
49-
50- 'domain' and 'target_language' parameters to 'translate()'
51- are ignored.
52-
53- Returned strings are always utf8-encoded.
54-
55- """
56-
57- OUTPUT_ENCODING = "utf-8"
58-
59- def translate (self , domain , msgid , mapping = None ,
60- context = None , target_language = None , default = None
61- ):
62- _msg = i18n .ugettext (msgid ).encode (self .OUTPUT_ENCODING )
63- #print ("TRANSLATE", msgid, _msg, mapping, context)
64- return _msg
65-
66- translationService = StaticTranslationService ()
38+ translationService = DummyTranslationService ()
6739
6840def setGlobalTranslationService (service ):
6941 """Sets the global translation service, and returns the previous one."""
0 commit comments