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
1919from roundup import i18n
2020from 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
4655class TranslationService (TranslationServiceMixin , i18n .RoundupTranslations ):
4756 pass
0 commit comments