summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2002-02-11 23:39:40 +0000
committerbwarsaw2002-02-11 23:39:40 +0000
commitfbf751938c41372badfe86fa9b658ca34feb81ff (patch)
tree9dff4f064ec497e7e40b5ac1636c7d02ad3751ab
parent57aaab8c864d6b792a705ebf2a797b6406ffbf3c (diff)
downloadmailman-fbf751938c41372badfe86fa9b658ca34feb81ff.tar.gz
mailman-fbf751938c41372badfe86fa9b658ca34feb81ff.tar.zst
mailman-fbf751938c41372badfe86fa9b658ca34feb81ff.zip
main(): First, set the global language to the list's preferred
language for the email message that's sent out. Then do the translation and UserNotification generation, then reset the language context and send the message. Patch by Ben Gertzfield, modified by Barry.
-rw-r--r--bin/change_pw26
-rwxr-xr-xbin/newlist8
2 files changed, 21 insertions, 13 deletions
diff --git a/bin/change_pw b/bin/change_pw
index 01db665e5..b2f0fed30 100644
--- a/bin/change_pw
+++ b/bin/change_pw
@@ -1,6 +1,6 @@
#! @PYTHON@
#
-# Copyright (C) 2001 by the Free Software Foundation, Inc.
+# Copyright (C) 2001,2002 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -74,7 +74,9 @@ from Mailman import Utils
from Mailman import MailList
from Mailman import Errors
from Mailman import Message
-from Mailman.i18n import _
+from Mailman import i18n
+
+_ = i18n._
SPACE = ' '
@@ -172,12 +174,15 @@ def main():
# Notification
print _('New %(listname)s password: %(notifypassword)s')
if not quiet:
- hostname = mlist.host_name
- adminurl = mlist.GetScriptURL('admin', absolute=1)
- msg = Message.UserNotification(
- mlist.owner[:], Utils.get_site_email(),
- _('Your new %(listname)s list password'),
- _('''\
+ otrans = i18n.get_translation()
+ i18n.set_language(mlist.preferred_language)
+ try:
+ hostname = mlist.host_name
+ adminurl = mlist.GetScriptURL('admin', absolute=1)
+ msg = Message.UserNotification(
+ mlist.owner[:], Utils.get_site_email(),
+ _('Your new %(listname)s list password'),
+ _('''\
The site administrator at %(hostname)s has changed the password for your
mailing list %(listname)s. It is now
@@ -188,7 +193,10 @@ to log in now to your list and change the password to something more to your
liking. Visit your list admin page at
%(adminurl)s
-'''))
+'''),
+ mlist.preferred_language)
+ finally:
+ i18n.set_translation(otrans)
msg.send(mlist)
diff --git a/bin/newlist b/bin/newlist
index 1ad1c7c52..66780aedd 100755
--- a/bin/newlist
+++ b/bin/newlist
@@ -1,6 +1,6 @@
#! @PYTHON@
#
-# Copyright (C) 1998,1999,2000,2001 by the Free Software Foundation, Inc.
+# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -196,16 +196,16 @@ def main():
# Set the I18N language to the list's preferred language so the header
# will match the template language. Stashing and restoring the old
# translation context is just (healthy? :) paranoia.
- otranslation = i18n.get_translation()
+ otrans = i18n.get_translation()
i18n.set_language(mlist.preferred_language)
try:
msg = Message.UserNotification(
owner_mail, siteadmin,
_('Your new mailing list: %(listname)s'),
- text)
+ text, mlist.preferred_language)
msg.send(mlist)
finally:
- i18n.set_translation(otranslation)
+ i18n.set_translation(otrans)