Skip to content

Commit ab8b24b

Browse files
author
Richard Jones
committed
handle 8-bit untranslateable messages in tracker templates
1 parent 3408a87 commit ab8b24b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Fixed:
77
- relax rules for required fields in form_parser.py (sf bug 1599740)
88
- documentation cleanup from Luke Ross (sf patch 1594860)
99
- updated Spanish translation from Ramiro Morales (sf patch 1594718)
10+
- handle 8-bit untranslateable messages in tracker templates
1011

1112

1213
2006-11-11 1.3.1

roundup/cgi/TranslationService.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# translate(domain, msgid, mapping, context, target_language, default)
1414
#
1515

16-
__version__ = "$Revision: 1.2 $"[11:-2]
17-
__date__ = "$Date: 2004-10-23 14:04:23 $"[7:-2]
16+
__version__ = "$Revision: 1.3 $"[11:-2]
17+
__date__ = "$Date: 2006-12-02 23:41:28 $"[7:-2]
1818

1919
from roundup import i18n
2020
from roundup.cgi.PageTemplates import Expressions, PathIterator, TALES
@@ -45,9 +45,15 @@ class TranslationService(TranslationServiceMixin, i18n.RoundupTranslations):
4545
pass
4646

4747
class NullTranslationService(TranslationServiceMixin,
48-
i18n.RoundupNullTranslations
49-
):
50-
pass
48+
i18n.RoundupNullTranslations):
49+
def ugettext(self, message):
50+
if self._fallback:
51+
return self._fallback.ugettext(message)
52+
# Sometimes the untranslatable message is a UTF-8 encoded string
53+
# (thanks to PageTemplate's internals).
54+
if not isinstance(message, unicode):
55+
return unicode(message, 'utf8')
56+
return message
5157

5258
### TAL patching
5359
#

0 commit comments

Comments
 (0)