Skip to content

Commit 69a57fe

Browse files
author
Alexander Smishlajev
committed
roll back to revision 1.1: since we aren't using DummyTranslationService...
...there is no need to patch it. roundup translation service moved to roundup.cgi.templating
1 parent 6687b6b commit 69a57fe

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

roundup/cgi/PageTemplates/GlobalTranslationService.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@
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

2322
import re
2423

25-
from roundup import i18n
26-
2724
from roundup.cgi.TAL.TALDefs import NAME_RE
2825

2926
ustr = 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

6840
def setGlobalTranslationService(service):
6941
"""Sets the global translation service, and returns the previous one."""

0 commit comments

Comments
 (0)