Mercurial > p > roundup > code
comparison roundup/cgi/TranslationService.py @ 3989:0112e9e1d068
improvements to session management
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 18 Aug 2008 05:04:02 +0000 |
| parents | f11fe2a13234 |
| children | 6e3e4f24c753 |
comparison
equal
deleted
inserted
replaced
| 3988:b50446ff16f4 | 3989:0112e9e1d068 |
|---|---|
| 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.5 $"[11:-2] | 16 __version__ = "$Revision: 1.6 $"[11:-2] |
| 17 __date__ = "$Date: 2008-08-07 05:51:32 $"[7:-2] | 17 __date__ = "$Date: 2008-08-18 05:04:01 $"[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 |
| 36 | 36 |
| 37 def gettext(self, msgid): | 37 def gettext(self, msgid): |
| 38 if not isinstance(msgid, unicode): | 38 if not isinstance(msgid, unicode): |
| 39 msgid = unicode(msgid, 'utf8') | 39 msgid = unicode(msgid, 'utf8') |
| 40 msgtrans=self.ugettext(msgid) | 40 msgtrans=self.ugettext(msgid) |
| 41 if not isinstance(msgtrans,unicode): | |
| 42 msgtrans=unicode(msgtrans, 'utf8') | |
| 43 return msgtrans.encode(self.OUTPUT_ENCODING) | 41 return msgtrans.encode(self.OUTPUT_ENCODING) |
| 44 | 42 |
| 45 def ngettext(self, singular, plural, number): | 43 def ngettext(self, singular, plural, number): |
| 46 if not isinstance(singular, unicode): | 44 if not isinstance(singular, unicode): |
| 47 singular = unicode(singular, 'utf8') | 45 singular = unicode(singular, 'utf8') |
| 48 if not isinstance(plural, unicode): | 46 if not isinstance(plural, unicode): |
| 49 plural = unicode(plural, 'utf8') | 47 plural = unicode(plural, 'utf8') |
| 50 msgtrans=self.ungettext(singular, plural, number) | 48 msgtrans=self.ungettext(singular, plural, number) |
| 51 if not isinstance(msgtrans,unicode): | |
| 52 msgtrans=unicode(msgtrans, 'utf8') | |
| 53 return msgtrans.encode(self.OUTPUT_ENCODING) | 49 return msgtrans.encode(self.OUTPUT_ENCODING) |
| 54 | 50 |
| 55 class TranslationService(TranslationServiceMixin, i18n.RoundupTranslations): | 51 class TranslationService(TranslationServiceMixin, i18n.RoundupTranslations): |
| 56 pass | 52 pass |
| 57 | 53 |
