Edgewall Software
Modify

Opened 17 years ago

Closed 16 years ago

#5958 closed defect (fixed)

i18n: patch for displaying error page correctly

Reported by: Shun-ichi Goto <shunichi.goto@…> 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

     
    6767    locale_dir = pkg_resources.resource_filename(__name__, '../locale')
    6868    _current.translations = Translations.load(locale_dir, locale)
    6969
     70_null_translation = NullTranslations()
     71
    7072def get_translations():
    71     return getattr(_current, 'translations', NullTranslations)
     73    return getattr(_current, 'translations', _null_translation)
    7274
    7375def deactivate():
    7476    del _current.translations

And also this is required to allow translation on error page.

  • trac/web/api.py

    R===================================================================
     
    336336            if template.endswith('.html'):
    337337                if env:
    338338                    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()
    341346                else:
    342347                    content_type = 'text/plain'
    343348                    data = '%s\n\n%s: %s' % (data.get('title'),

Attachments (0)

Change History (3)

comment:1 by Christian Boos, 16 years ago

Milestone: 0.12

cmlenz or asmodai, can one of you have a look?

comment:2 by Jeroen Ruigrok van der Werven, 16 years ago

Owner: changed from Jonas Borgström to Jeroen Ruigrok van der Werven
Status: newassigned

Yes, a real problem.

I applied the fix to translation.py, small change from _null_translation to _null_translations.

comment:3 by Jeroen Ruigrok van der Werven, 16 years ago

Resolution: fixed
Status: assignedclosed

Committed in r6439 and r6441.

Thanks.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jeroen Ruigrok van der Werven.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jeroen Ruigrok van der Werven to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.