changeset 3775:beaf7ea86e5e

handle 8-bit untranslateable messages in tracker templates
author Richard Jones <richard@users.sourceforge.net>
date Sat, 02 Dec 2006 23:41:28 +0000
parents 46e3d5d0901d
children 1ac3c7ed91e8
files CHANGES.txt roundup/cgi/TranslationService.py
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Fri Dec 01 10:38:40 2006 +0000
+++ b/CHANGES.txt	Sat Dec 02 23:41:28 2006 +0000
@@ -7,6 +7,7 @@
 - relax rules for required fields in form_parser.py (sf bug 1599740)
 - documentation cleanup from Luke Ross (sf patch 1594860)
 - updated Spanish translation from Ramiro Morales (sf patch 1594718)
+- handle 8-bit untranslateable messages in tracker templates
 
 
 2006-11-11 1.3.1
--- a/roundup/cgi/TranslationService.py	Fri Dec 01 10:38:40 2006 +0000
+++ b/roundup/cgi/TranslationService.py	Sat Dec 02 23:41:28 2006 +0000
@@ -13,8 +13,8 @@
 #   translate(domain, msgid, mapping, context, target_language, default)
 #
 
-__version__ = "$Revision: 1.2 $"[11:-2]
-__date__ = "$Date: 2004-10-23 14:04:23 $"[7:-2]
+__version__ = "$Revision: 1.3 $"[11:-2]
+__date__ = "$Date: 2006-12-02 23:41:28 $"[7:-2]
 
 from roundup import i18n
 from roundup.cgi.PageTemplates import Expressions, PathIterator, TALES
@@ -45,9 +45,15 @@
     pass
 
 class NullTranslationService(TranslationServiceMixin,
-    i18n.RoundupNullTranslations
-):
-    pass
+        i18n.RoundupNullTranslations):
+    def ugettext(self, message):
+        if self._fallback:
+            return self._fallback.ugettext(message)
+        # Sometimes the untranslatable message is a UTF-8 encoded string
+        # (thanks to PageTemplate's internals).
+        if not isinstance(message, unicode):
+            return unicode(message, 'utf8')
+        return message
 
 ### TAL patching
 #

Roundup Issue Tracker: http://roundup-tracker.org/