summaryrefslogtreecommitdiff
path: root/Mailman/Queue/Runner.py
diff options
context:
space:
mode:
authorbwarsaw2001-03-02 00:56:51 +0000
committerbwarsaw2001-03-02 00:56:51 +0000
commitcbd1b5d3e5833051b9c8d166f89bfdda76bf8bd3 (patch)
tree1553b53ae3f11a2c27dd298262f790a3705654f8 /Mailman/Queue/Runner.py
parent36012989e9c1bda2cb0b2a1ef0f23bb5ab1d4027 (diff)
downloadmailman-cbd1b5d3e5833051b9c8d166f89bfdda76bf8bd3.tar.gz
mailman-cbd1b5d3e5833051b9c8d166f89bfdda76bf8bd3.tar.zst
mailman-cbd1b5d3e5833051b9c8d166f89bfdda76bf8bd3.zip
Diffstat (limited to 'Mailman/Queue/Runner.py')
-rw-r--r--Mailman/Queue/Runner.py19
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)