Yasuhito FUTATSUKI at POEM has proposed merging
lp:~futatuki/mailman/i18n-add-whence-to-adminack-templates into lp:mailman/2.1.
Commit message:
i18nize whence candidate message strings
Requested reviews:
Mailman Coders (mailman-coders)
For more details, see:
https://code.launchpad.net/~futatuki/mailman/i18n-add-whence-to-adminack-templates/+merge/348127
This is a solution of problem left in mp+347992.
To mark whence messages for pygettext, I introduced dummy function i18n.D_(s)
returns s it self,
and then added "-k D_" option to pygettext commandline in messages/Makefile.in.
This costs extra function call on execute, for its maintenancebility.
I've picked up whence candidate message strings except from bin/add_member,
bin/delete_member, and cron/disabled, and tested with ja translation (temporary
for test, not included in this proposal).
Note:
* whence messages for user conformation of subscribe and unsubscribe are
inconsistent.
For subscribe they are 'via email confirmation' and 'via web confirmation',
but
for unsubscribe they are 'email confirmation' and 'web confirmation'.
* admin approval for unsubscription dosen't report whence because
ListAdmin.__handleunsubscription() calls ApproveDeleteMember() without whence
option.
--
Your team Mailman Coders is requested to review the proposed merge of
lp:~futatuki/mailman/i18n-add-whence-to-adminack-templates into lp:mailman/2.1.
=== modified file 'Mailman/Bouncer.py'
--- Mailman/Bouncer.py 2017-06-02 22:25:12 +0000
+++ Mailman/Bouncer.py 2018-06-17 13:04:43 +0000
@@ -49,6 +49,7 @@
}
_ = i18n._
+D_ = i18n.D_
@@ -265,7 +266,7 @@
if info.noticesleft <= 0:
# BAW: Remove them now, with a notification message
self.ApprovedDeleteMember(
- member, 'disabled address',
+ member, D_('disabled address'),
admin_notif=self.bounce_notify_owner_on_removal,
userack=1)
# Expunge the pending cookie for the user. We throw away the
=== modified file 'Mailman/Cgi/admin.py'
--- Mailman/Cgi/admin.py 2018-06-11 16:59:26 +0000
+++ Mailman/Cgi/admin.py 2018-06-17 13:04:43 +0000
@@ -47,6 +47,7 @@
# Set up i18n
_ = i18n._
i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+D_ = i18n.D_
NL = '\n'
OPTCOLUMNS = 11
@@ -1484,7 +1485,7 @@
else:
mlist.ApprovedAddMember(userdesc, send_welcome_msg,
send_admin_notif, invitation,
- whence='admin mass sub')
+ whence=D_('admin mass sub'))
except Errors.MMAlreadyAMember:
subscribe_errors.append((safeentry, _('Already a member')))
except Errors.MMBadEmailError:
@@ -1538,7 +1539,7 @@
for addr in names:
try:
mlist.ApprovedDeleteMember(
- addr, whence='admin mass unsub',
+ addr, whence=D_('admin mass unsub'),
admin_notif=send_unsub_notifications,
userack=userack)
unsubscribe_success.append(Utils.websafe(addr))
@@ -1645,7 +1646,8 @@
quser = urllib.quote(user)
if cgidata.has_key('%s_unsub' % quser):
try:
- mlist.ApprovedDeleteMember(user, whence='member mgt page')
+ mlist.ApprovedDeleteMember(user,
+ whence=D_('member mgt page'))
removes.append(user)
except Errors.NotAMemberError:
errors.append((user, _('Not subscribed')))
=== modified file 'Mailman/Cgi/options.py'
--- Mailman/Cgi/options.py 2018-06-11 16:59:26 +0000
+++ Mailman/Cgi/options.py 2018-06-17 13:04:43 +0000
@@ -45,6 +45,7 @@
# Set up i18n
_ = i18n._
i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+D_ = i18n.D_
try:
True, False
@@ -583,7 +584,7 @@
try:
try:
mlist.DeleteMember(
- user, 'via the member options page', userack=1)
+ user, D_('via the member options page'), userack=1)
except Errors.MMNeedApproval:
needapproval = True
except Errors.NotAMemberError:
=== modified file 'Mailman/ListAdmin.py'
--- Mailman/ListAdmin.py 2017-06-02 22:25:12 +0000
+++ Mailman/ListAdmin.py 2018-06-17 13:04:43 +0000
@@ -45,6 +45,7 @@
from Mailman import i18n
_ = i18n._
+D_ = i18n.D_
# Request types requiring admin approval
IGN = 0
@@ -436,7 +437,8 @@
assert value == mm_cfg.SUBSCRIBE
try:
userdesc = UserDesc(addr, fullname, password, digest, lang)
- self.ApprovedAddMember(userdesc, whence='via admin approval')
+ self.ApprovedAddMember(userdesc,
+ whence=D_('via admin approval'))
except Errors.MMAlreadyAMember:
# User has already been subscribed, after sending the request
pass
=== modified file 'Mailman/MailList.py'
--- Mailman/MailList.py 2018-06-16 16:39:45 +0000
+++ Mailman/MailList.py 2018-06-17 13:04:43 +0000
@@ -72,6 +72,7 @@
from Mailman.Logging.Syslog import syslog
_ = i18n._
+D_ = i18n.D_
EMPTYSTRING = ''
OR = '|'
@@ -1071,6 +1072,7 @@
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:
@@ -1081,7 +1083,7 @@
"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)
@@ -1118,7 +1120,7 @@
'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)
@@ -1307,7 +1309,7 @@
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
@@ -1316,7 +1318,7 @@
# 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
@@ -1348,9 +1350,9 @@
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
=== modified file 'Mailman/i18n.py'
--- Mailman/i18n.py 2017-01-18 06:49:29 +0000
+++ Mailman/i18n.py 2018-06-17 13:04:43 +0000
@@ -123,7 +123,10 @@
def C_(s):
return tolocale(_(s, 2))
-
+# marking for pygettext
+def D_(s):
+ return s
+
def ctime(date):
# Don't make these module globals since we have to do runtime translation
=== modified file 'messages/Makefile.in'
--- messages/Makefile.in 2018-06-04 01:12:09 +0000
+++ messages/Makefile.in 2018-06-17 13:04:43 +0000
@@ -139,7 +139,7 @@
potfile: marked.files docstring.files
@echo "Running pygettext on $@; this make take a while."
- (cd ..; $(PROG) -k C_ -p messages -d mailman -D -X messages/marked.files `cat messages/marked.files messages/docstring.files`)
+ (cd ..; $(PROG) -k C_ -k D_ -p messages -d mailman -D -X messages/marked.files `cat messages/marked.files messages/docstring.files`)
# Update the individual mailman.po files with the new changes to the
# .pot file
_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders