Skip to content

Commit b270892

Browse files
author
Richard Jones
committed
Fix for translations (patch [SF#2032526])
1 parent 204409d commit b270892

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Fixed:
88
- Send a Precedence header in email so autoresponders don't
99
- Fix mailgw total failure bounce message generation (thanks Bradley Dean)
1010
- Fix for postgres 8.3 compatibility (and bug) (sf patch #2030479)
11+
- Fix for translations (sf patch #2032526)
1112

1213

1314
2008-03-01 1.4.4

roundup/cgi/TranslationService.py

Lines changed: 14 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.4 $"[11:-2]
17-
__date__ = "$Date: 2007-01-14 22:54:15 $"[7:-2]
16+
__version__ = "$Revision: 1.5 $"[11:-2]
17+
__date__ = "$Date: 2008-08-07 05:51:32 $"[7:-2]
1818

1919
from roundup import i18n
2020
from roundup.cgi.PageTemplates import Expressions, PathIterator, TALES
@@ -37,11 +37,20 @@ def translate(self, domain, msgid, mapping=None,
3737
def gettext(self, msgid):
3838
if not isinstance(msgid, unicode):
3939
msgid = unicode(msgid, 'utf8')
40-
return self.ugettext(msgid).encode(self.OUTPUT_ENCODING)
40+
msgtrans=self.ugettext(msgid)
41+
if not isinstance(msgtrans,unicode):
42+
msgtrans=unicode(msgtrans, 'utf8')
43+
return msgtrans.encode(self.OUTPUT_ENCODING)
4144

4245
def ngettext(self, singular, plural, number):
43-
return self.ungettext(singular, plural, number).encode(
44-
self.OUTPUT_ENCODING)
46+
if not isinstance(singular, unicode):
47+
singular = unicode(singular, 'utf8')
48+
if not isinstance(plural, unicode):
49+
plural = unicode(plural, 'utf8')
50+
msgtrans=self.ungettext(singular, plural, number)
51+
if not isinstance(msgtrans,unicode):
52+
msgtrans=unicode(msgtrans, 'utf8')
53+
return msgtrans.encode(self.OUTPUT_ENCODING)
4554

4655
class TranslationService(TranslationServiceMixin, i18n.RoundupTranslations):
4756
pass

0 commit comments

Comments
 (0)