Modify ↓
Opened 17 years ago
Closed 17 years ago
#5958 closed defect (fixed)
i18n: patch for displaying error page correctly
Reported by: | Owned by: | Jeroen Ruigrok van der Werven | |
---|---|---|---|
Priority: | normal | Milestone: | 0.12 |
Component: | general | Version: | devel |
Severity: | normal | Keywords: | i18n |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
On i18n branch, this patch corrects passing NullTranslations
instance
instead of class object.
This is caused on running tracd without auth then select 'login'.
-
trac/util/translation.py
67 67 locale_dir = pkg_resources.resource_filename(__name__, '../locale') 68 68 _current.translations = Translations.load(locale_dir, locale) 69 69 70 _null_translation = NullTranslations() 71 70 72 def get_translations(): 71 return getattr(_current, 'translations', NullTranslations)73 return getattr(_current, 'translations', _null_translation) 72 74 73 75 def deactivate(): 74 76 del _current.translations
And also this is required to allow translation on error page.
-
trac/web/api.py
R===================================================================
336 336 if template.endswith('.html'): 337 337 if env: 338 338 from trac.web.chrome import Chrome 339 data = Chrome(env).render_template(self, template, data, 340 'text/html') 339 from trac.util import translation 340 translation.activate(self.locale) 341 try: 342 data = Chrome(env).render_template(self, template, data, 343 'text/html') 344 finally: 345 translation.deactivate() 341 346 else: 342 347 content_type = 'text/plain' 343 348 data = '%s\n\n%s: %s' % (data.get('title'),
Attachments (0)
Change History (3)
comment:1 by , 17 years ago
Milestone: | → 0.12 |
---|
comment:2 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Yes, a real problem.
I applied the fix to translation.py, small change from _null_translation
to _null_translations
.
comment:3 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
cmlenz or asmodai, can one of you have a look?