Mercurial > p > roundup > code
comparison roundup/cgi/TranslationService.py @ 5477:b0c2307be3d1
applied remaining part of original patch 045 (slightly modified)
| author | Christof Meerwald <cmeerw@cmeerw.org> |
|---|---|
| date | Mon, 30 Jul 2018 22:09:48 +0100 |
| parents | 41532b2ab141 |
| children | 718f205dbe50 |
comparison
equal
deleted
inserted
replaced
| 5476:b0048969990d | 5477:b0c2307be3d1 |
|---|---|
| 45 class TranslationService(TranslationServiceMixin, i18n.RoundupTranslations): | 45 class TranslationService(TranslationServiceMixin, i18n.RoundupTranslations): |
| 46 pass | 46 pass |
| 47 | 47 |
| 48 class NullTranslationService(TranslationServiceMixin, | 48 class NullTranslationService(TranslationServiceMixin, |
| 49 i18n.RoundupNullTranslations): | 49 i18n.RoundupNullTranslations): |
| 50 def ugettext(self, message): | 50 if hasattr(i18n.RoundupNullTranslations, 'ugettext'): |
| 51 if self._fallback: | 51 def ugettext(self, message): |
| 52 return self._fallback.ugettext(message) | 52 if self._fallback: |
| 53 # Sometimes the untranslatable message is a UTF-8 encoded string | 53 return self._fallback.ugettext(message) |
| 54 # (thanks to PageTemplate's internals). | 54 # Sometimes the untranslatable message is a UTF-8 encoded string |
| 55 message = us2u(message) | 55 # (thanks to PageTemplate's internals). |
| 56 return message | 56 message = us2u(message) |
| 57 return message | |
| 57 | 58 |
| 58 ### TAL patching | 59 ### TAL patching |
| 59 # | 60 # |
| 60 # Template Attribute Language (TAL) uses only global translation service, | 61 # Template Attribute Language (TAL) uses only global translation service, |
| 61 # which is not thread-safe. We will use context variable 'i18n' | 62 # which is not thread-safe. We will use context variable 'i18n' |
