From f8d6bcc2c18e6a3d857dd99be24084c6488590c4 Mon Sep 17 00:00:00 2001 From: Yasuhito FUTATSUKI at POEM Date: Sat, 16 Jun 2018 02:46:52 +0900 Subject: enhance i18n in admin(un)?subscribeack messages --- Mailman/MailList.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Mailman/MailList.py') diff --git a/Mailman/MailList.py b/Mailman/MailList.py index cc1be3b5..72b50a11 100755 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -1075,7 +1075,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, "adminsubscribeack.txt", {"listname" : realname, "member" : formataddr((name, email)), - "whence" : "" if whence is None else "(" + whence + ")" + "whence" : "" if whence is None else "(" + _(whence) + ")" }, mlist=self) msg = Message.OwnerNotification(self, subject, text) msg.send(self) @@ -1112,7 +1112,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, 'adminunsubscribeack.txt', {'member' : name, 'listname': self.real_name, - "whence" : "" if whence is None else "(" + whence + ")" + "whence" : "" if whence is None else "(" + _(whence) + ")" }, mlist=self) msg = Message.OwnerNotification(self, subject, text) msg.send(self) -- cgit v1.2.3 From 17a8600ed2bc13b01a6443f9b9f2fa21ff1be0c6 Mon Sep 17 00:00:00 2001 From: Yasuhito FUTATSUKI at POEM Date: Sat, 16 Jun 2018 04:45:33 +0900 Subject: whence should be translated to lists language for admin notify --- Mailman/MailList.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Mailman/MailList.py') diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 72b50a11..03af588d 100755 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -1065,6 +1065,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, otrans = i18n.get_translation() i18n.set_language(lang) try: + whence = "" if whence is None else "(" + _(whence) + ")" realname = self.real_name subject = _('%(realname)s subscription notification') finally: @@ -1075,7 +1076,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, "adminsubscribeack.txt", {"listname" : realname, "member" : formataddr((name, email)), - "whence" : "" if whence is None else "(" + _(whence) + ")" + "whence" : whence }, mlist=self) msg = Message.OwnerNotification(self, subject, text) msg.send(self) -- cgit v1.2.3 From 3e3819ce7fa318f5e60b2f04ae94b48698ab73a5 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Sat, 16 Jun 2018 09:39:45 -0700 Subject: Preserve translation accross a call to SendSubscribeAck(). --- Mailman/MailList.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Mailman/MailList.py') diff --git a/Mailman/MailList.py b/Mailman/MailList.py index cc1be3b5..abc46abd 100755 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -1058,8 +1058,14 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, syslog('subscribe', '%s: new%s %s, %s', self.internal_name(), kind, formataddr((name, email)), whence) if ack: - self.SendSubscribeAck(email, self.getMemberPassword(email), - digest, text) + lang = self.preferred_language + otrans = i18n.get_translation() + i18n.set_language(lang) + try: + self.SendSubscribeAck(email, self.getMemberPassword(email), + digest, text) + finally: + i18n.set_translation(otrans) if admin_notif: lang = self.preferred_language otrans = i18n.get_translation() -- cgit v1.2.3 From b885614b0c7b14040be7919c98636b00ad4973ce Mon Sep 17 00:00:00 2001 From: Yasuhito FUTATSUKI at POEM Date: Sun, 17 Jun 2018 16:41:38 +0900 Subject: add missed whence msgid in previous commit --- Mailman/MailList.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Mailman/MailList.py') diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 03af588d..e8a6bbf0 100755 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -72,6 +72,7 @@ from Mailman import i18n from Mailman.Logging.Syslog import syslog _ = i18n._ +D_ = i18n.D_ EMPTYSTRING = '' OR = '|' @@ -1302,7 +1303,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, except ValueError: raise Errors.MMBadConfirmation, 'op-less data %s' % (rec,) if op == Pending.SUBSCRIPTION: - whence = 'via email confirmation' + whence = D_('via email confirmation') try: userdesc = data[0] # If confirmation comes from the web, context should be a @@ -1311,7 +1312,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, # context is a Message and isn't relevant, so ignore it. if isinstance(context, UserDesc): userdesc += context - whence = 'via web confirmation' + whence = D_('via web confirmation') addr = userdesc.address fullname = userdesc.fullname password = userdesc.password @@ -1343,9 +1344,9 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, addr = data[0] # Log file messages don't need to be i18n'd if isinstance(context, Message.Message): - whence = 'email confirmation' + whence = D_('email confirmation') else: - whence = 'web confirmation' + whence = D_('web confirmation') # Can raise NotAMemberError if they unsub'd via other means self.ApprovedDeleteMember(addr, whence=whence) return op, addr -- cgit v1.2.3