From 6aaafb6c05840389f1dd9139da9694f3b43c57df Mon Sep 17 00:00:00 2001 From: Yasuhito FUTATSUKI at POEM Date: Mon, 22 Feb 2016 17:51:37 +0900 Subject: Importing locale patch for command line utils, from RHEL6 rpm source (for -japan-poem, originally imported from 2.1.12-18 package for RHEL6 rpm source) --- bin/sync_members | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'bin/sync_members') diff --git a/bin/sync_members b/bin/sync_members index 0c860d25..2ac73d2e 100755 --- a/bin/sync_members +++ b/bin/sync_members @@ -86,7 +86,7 @@ from Mailman import MailList from Mailman import Errors from Mailman import Utils from Mailman.UserDesc import UserDesc -from Mailman.i18n import _ +from Mailman.i18n import C_ @@ -97,7 +97,7 @@ def usage(code, msg=''): fd = sys.stderr else: fd = sys.stdout - print >> fd, _(__doc__) + print >> fd, C_(__doc__) if msg: print >> fd, msg sys.exit(code) @@ -112,7 +112,7 @@ def yesno(opt): elif yesno in ('n', 'no'): return 0 else: - usage(1, _('Bad choice: %(yesno)s')) + usage(1, C_('Bad choice: %(yesno)s')) # no return @@ -135,7 +135,7 @@ def main(): elif opt in ('-n', '--no-change'): dryrun = 1 i += 1 - print _('Dry run mode') + print C_('Dry run mode') elif opt in ('-d', '--digest'): digest = 1 i += 1 @@ -156,11 +156,11 @@ def main(): i += 1 elif opt in ('-f', '--file'): if filename is not None: - usage(1, _('Only one -f switch allowed')) + usage(1, C_('Only one -f switch allowed')) try: filename = sys.argv[i+1] except IndexError: - usage(1, _('No argument to -f given')) + usage(1, C_('No argument to -f given')) i += 2 elif opt in ('-a', '--notifyadmin'): notifyadmin = 1 @@ -169,17 +169,17 @@ def main(): notifyadmin = yesno(opt) i += 1 elif opt[0] == '-': - usage(1, _('Illegal option: %(opt)s')) + usage(1, C_('Illegal option: %(opt)s')) else: try: listname = sys.argv[i].lower() i += 1 except IndexError: - usage(1, _('No listname given')) + usage(1, C_('No listname given')) break if listname is None or filename is None: - usage(1, _('Must have a listname and a filename')) + usage(1, C_('Must have a listname and a filename')) # read the list of addresses to sync to from the file if filename == '-': @@ -188,7 +188,7 @@ def main(): try: fp = open(filename) except IOError, (code, msg): - usage(1, _('Cannot read address file: %(filename)s: %(msg)s')) + usage(1, C_('Cannot read address file: %(filename)s: %(msg)s')) try: filemembers = fp.readlines() finally: @@ -200,7 +200,7 @@ def main(): addr = filemembers[i].strip() if addr == '' or addr[:1] == '#': del filemembers[i] - print _('Ignore : %(addr)30s') + print C_('Ignore : %(addr)30s') # first filter out any invalid addresses filemembers = email.Utils.getaddresses(filemembers) @@ -209,17 +209,17 @@ def main(): try: Utils.ValidateEmail(addr) except Errors.EmailAddressError: - print _('Invalid : %(addr)30s') + print C_('Invalid : %(addr)30s') invalid = 1 if invalid: - print _('You must fix the preceding invalid addresses first.') + print C_('You must fix the preceding invalid addresses first.') sys.exit(1) # get the locked list object try: mlist = MailList.MailList(listname) except Errors.MMListError, e: - print _('No such list: %(listname)s') + print C_('No such list: %(listname)s') sys.exit(1) try: @@ -241,7 +241,7 @@ def main(): needsadding[laddr] = (name, addr) if not needsadding and not addrs: - print _('Nothing to do.') + print C_('Nothing to do.') sys.exit(0) enc = sys.getdefaultencoding() @@ -261,7 +261,7 @@ def main(): name = unicode(name, errors='replace') name = name.encode(enc, 'replace') s = email.Utils.formataddr((name, addr)).encode(enc, 'replace') - print _('Added : %(s)s') + print C_('Added : %(s)s') except Errors.MMAlreadyAMember: pass except Errors.MembershipIsBanned, pattern: @@ -285,7 +285,7 @@ def main(): name = unicode(name, errors='replace') name = name.encode(enc, 'replace') s = email.Utils.formataddr((name, addr)).encode(enc, 'replace') - print _('Removed: %(s)s') + print C_('Removed: %(s)s') mlist.Save() finally: -- cgit v1.2.3 From e7519290ad288df840bc86d8dcaea524407df964 Mon Sep 17 00:00:00 2001 From: Yasuhito FUTATSUKI at POEM Date: Mon, 22 Feb 2016 20:06:27 +0900 Subject: * add option to pick up C_() texts to make potfile * revise command line utils _()/C_() usage (not tested at all) --- bin/sync_members | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/sync_members') diff --git a/bin/sync_members b/bin/sync_members index 2ac73d2e..bb5eaa73 100755 --- a/bin/sync_members +++ b/bin/sync_members @@ -265,7 +265,7 @@ def main(): except Errors.MMAlreadyAMember: pass except Errors.MembershipIsBanned, pattern: - print ('%s:' % addr), _('Banned address (matched %(pattern)s)') + print ('%s:' % addr), C_('Banned address (matched %(pattern)s)') for laddr, addr in addrs.items(): # Should be a member, otherwise our test above is broken -- cgit v1.2.3