Mercurial > p > roundup > code
comparison roundup/cgi/TranslationService.py @ 3806:a16239e37598
Handle 8-bit untranslateable messages from database properties
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 14 Jan 2007 22:54:15 +0000 |
| parents | beaf7ea86e5e |
| children | f11fe2a13234 |
comparison
equal
deleted
inserted
replaced
| 3805:f86d9531c8db | 3806:a16239e37598 |
|---|---|
| 11 # method which is used by TAL engines: | 11 # method which is used by TAL engines: |
| 12 # | 12 # |
| 13 # translate(domain, msgid, mapping, context, target_language, default) | 13 # translate(domain, msgid, mapping, context, target_language, default) |
| 14 # | 14 # |
| 15 | 15 |
| 16 __version__ = "$Revision: 1.3 $"[11:-2] | 16 __version__ = "$Revision: 1.4 $"[11:-2] |
| 17 __date__ = "$Date: 2006-12-02 23:41:28 $"[7:-2] | 17 __date__ = "$Date: 2007-01-14 22:54:15 $"[7:-2] |
| 18 | 18 |
| 19 from roundup import i18n | 19 from roundup import i18n |
| 20 from roundup.cgi.PageTemplates import Expressions, PathIterator, TALES | 20 from roundup.cgi.PageTemplates import Expressions, PathIterator, TALES |
| 21 from roundup.cgi.TAL import TALInterpreter | 21 from roundup.cgi.TAL import TALInterpreter |
| 22 | 22 |
| 33 #print ("TRANSLATE", msgid, _msg, mapping, context) | 33 #print ("TRANSLATE", msgid, _msg, mapping, context) |
| 34 _msg = TALInterpreter.interpolate(_msg, mapping) | 34 _msg = TALInterpreter.interpolate(_msg, mapping) |
| 35 return _msg | 35 return _msg |
| 36 | 36 |
| 37 def gettext(self, msgid): | 37 def gettext(self, msgid): |
| 38 if not isinstance(msgid, unicode): | |
| 39 msgid = unicode(msgid, 'utf8') | |
| 38 return self.ugettext(msgid).encode(self.OUTPUT_ENCODING) | 40 return self.ugettext(msgid).encode(self.OUTPUT_ENCODING) |
| 39 | 41 |
| 40 def ngettext(self, singular, plural, number): | 42 def ngettext(self, singular, plural, number): |
| 41 return self.ungettext(singular, plural, number).encode( | 43 return self.ungettext(singular, plural, number).encode( |
| 42 self.OUTPUT_ENCODING) | 44 self.OUTPUT_ENCODING) |
