diff options
| -rw-r--r-- | Mailman/Queue/Runner.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Mailman/Queue/Runner.py b/Mailman/Queue/Runner.py index cf766f807..c896fb4c4 100644 --- a/Mailman/Queue/Runner.py +++ b/Mailman/Queue/Runner.py @@ -25,6 +25,7 @@ from Mailman import mm_cfg from Mailman import Utils from Mailman import Errors from Mailman import MailList +from Mailman import i18n from Mailman.pythonlib.StringIO import StringIO from Mailman.Queue.Switchboard import Switchboard @@ -121,7 +122,23 @@ class Runner: return # Now process this message, keeping track of any subprocesses that may # have been spawned. We'll reap those later. - keepqueued = self._dispose(mlist, msg, msgdata) + # + # We also want to set up the language context for this message. The + # context will be the preferred language for the user if a member of + # the list, or the list's preferred language. However, we must take + # special care to reset the defaults, otherwise subsequent messages + # may be translated incorrectly. BAW: I'm not sure I like this + # approach, but I can't think of anything better right now. + otranslation = i18n.get_translation() + sender = msg.get_sender() + lang = mlist.GetPreferredLanguage(sender) + i18n.set_language(lang) + msgdata['lang'] = lang + try: + keepqueued = self._dispose(mlist, msg, msgdata) + finally: + i18n.set_translation(otranslation) + # Keep tabs on any child processes that got spawned. kids = msgdata.get('_kids') if kids: self._kids.update(kids) |
