Edgewall Software
Modify

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#11515 closed defect (fixed)

Acknowledgement message is not localized when changing language

Reported by: Ryan J Ollos Owned by: Jun Omae
Priority: normal Milestone: 1.0.2
Component: i18n Version:
Severity: normal Keywords:
Cc: Jun Omae Branch:
Release Notes:

Show acknowledgement message with new language setting when changed in user preferences.

API Changes:

Description

When changing languages through the preferences admin page, the notification message is displayed in the previous language:

English → French

French → English

Attachments (2)

EnglishToFrancais.png (44.7 KB ) - added by Ryan J Ollos 6 years ago.
FrancaisToEnglish.png (44.6 KB ) - added by Ryan J Ollos 6 years ago.

Download all attachments as: .zip

Change History (9)

by Ryan J Ollos, 6 years ago

Attachment: EnglishToFrancais.png added

by Ryan J Ollos, 6 years ago

Attachment: FrancaisToEnglish.png added

comment:1 by Jun Omae, 6 years ago

Ad-hoc patch.

  • trac/prefs/web_ui.py

    diff --git a/trac/prefs/web_ui.py b/trac/prefs/web_ui.py
    index 5a428c2..cdc1867 100644
    a b from genshi.builder import tag  
    2727from trac.core import *
    2828from trac.prefs.api import IPreferencePanelProvider
    2929from trac.util.datefmt import all_timezones, get_timezone, localtz
    30 from trac.util.translation import _, get_available_locales
    31 from trac.web import HTTPNotFound, IRequestHandler
     30from trac.util.translation import _, deactivate, get_available_locales, \
     31                                  make_activable
     32from trac.web.api import HTTPNotFound, IRequestHandler
    3233from trac.web.chrome import add_notice, add_stylesheet, \
    3334                            INavigationContributor, ITemplateProvider
     35from trac.web.main import RequestDispatcher
    3436
    class PreferencesModule(Component):  
    148150        req.send_no_content()
    149151
    150152    def _do_save(self, req):
     153        language = req.session.get('language')
    151154        for field in self._form_fields:
    152155            val = req.args.get(field, '').strip()
    153156            if val:
    class PreferencesModule(Component):  
    163166            elif field in req.session and (field in req.args or
    164167                                           field + '_cb' in req.args):
    165168                del req.session[field]
     169        if req.session.get('language') != language:
     170            # reactivate translations with new language setting when changed
     171            locale = RequestDispatcher(self.env)._get_locale(req)
     172            deactivate()
     173            make_activable(lambda: locale, self.env.path)
    166174        add_notice(req, _('Your preferences have been saved.'))
    167175
    168176    def _do_load(self, req):
Last edited 6 years ago by Jun Omae (previous) (diff)

comment:2 by Jun Omae, 6 years ago

Cc: Jun Omae added

I've revised the patch and added functional tests, jomae.git@t11515.

comment:3 by Ryan J Ollos, 6 years ago

Thanks for the quick fix. The changes work well for me.

comment:4 by Jun Omae, 6 years ago

Milestone: next-stable-1.0.x1.0.2
Owner: set to Jun Omae
Status: newassigned

Thanks for testing. I'll push the changes later.

comment:5 by Jun Omae, 6 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [12578] and merged to trunk in [12579].

comment:6 by Jun Omae, 5 years ago

RegressionTestTicket11515 intermittently fails on autobuilds. See comment:19:ticket:11813.

comment:7 by Jun Omae, 5 years ago

Fixed the failure in [13299] and merged to trunk in [13300].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Jun Omae 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.