Mercurial > p > roundup > code
comparison roundup/cgi/PageTemplates/TALES.py @ 6658:408fd477761f
Add i18n object to roundupdb.Database
This makes the i18n object accessible everywhere (including in detectors
where localized error messages were impossible). See issue2551184
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Tue, 03 May 2022 14:51:59 +0200 |
| parents | 883c9e90b403 |
| children | bd4097fa0671 |
comparison
equal
deleted
inserted
replaced
| 6657:2453d7b58a92 | 6658:408fd477761f |
|---|---|
| 255 self.source_file = source_file | 255 self.source_file = source_file |
| 256 | 256 |
| 257 def setPosition(self, position): | 257 def setPosition(self, position): |
| 258 self.position = position | 258 self.position = position |
| 259 | 259 |
| 260 def translate(self, domain, msgid, mapping=None, | |
| 261 context=None, target_language=None, default=None): | |
| 262 if context is None: | |
| 263 context = self.contexts.get('here') | |
| 264 return getGlobalTranslationService().translate( | |
| 265 domain, msgid, mapping=mapping, | |
| 266 context=context, | |
| 267 default=default, | |
| 268 target_language=target_language) | |
| 269 | |
| 270 class TALESTracebackSupplement: | 260 class TALESTracebackSupplement: |
| 271 """Implementation of ITracebackSupplement""" | 261 """Implementation of ITracebackSupplement""" |
| 272 def __init__(self, context, expression): | 262 def __init__(self, context, expression): |
| 273 self.context = context | 263 self.context = context |
| 274 self.source_url = context.source_file | 264 self.source_url = context.source_file |
