From 0693203d773470a61aed508c29331d5ec4c5f8ef Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Thu, 7 Dec 2000 22:55:33 +0000 Subject: First integration patch for Juan Carlos's translatable string changes --- Mailman/MailCommandHandler.py | 230 +++++++++++++++++++++--------------------- 1 file changed, 116 insertions(+), 114 deletions(-) (limited to 'Mailman/MailCommandHandler.py') diff --git a/Mailman/MailCommandHandler.py b/Mailman/MailCommandHandler.py index 88cd8db1d..0dd81b7f7 100644 --- a/Mailman/MailCommandHandler.py +++ b/Mailman/MailCommandHandler.py @@ -33,6 +33,7 @@ from Mailman import Utils from Mailman.Handlers import HandlerAPI from Mailman.Logging.Syslog import syslog from Mailman.pythonlib.StringIO import StringIO +from Mailman.i18n import _ @@ -40,26 +41,26 @@ MAXERRORS = 5 MAXCOLUMN = 70 option_descs = { - 'hide' : '''When turned on, your email address is concealed -on the Web page that lists the members of the mailing list.''', - 'nomail' : '''When turned on, delivery to your email address is disabled, -but your address is still subscribed. This is useful if you plan on -taking a short vacation.''', - 'ack' : '''When turned on, you get a separate acknowledgement email -when you post messages to the list.''', - 'notmetoo': '''When turned on, you do *not* get copies of your own -posts to the list. Otherwise, you do get copies of your own posts - (yes, this seems a little backwards). This does not affect the contents -of digests, so if you receive postings in digests, you will always get -copies of your messages in the digest.''', - 'digest' : '''When turned on, you get postings from the list bundled -into digests. Otherwise, you get each individual message immediately as -it is posted to the list.''', - 'plain' : """When turned on, you get `plain' digests, which are actually -formatted using the older RFC934 digest format. This format can be easier -to read if you have a non-MIME compliant mail reader. When this option is -turned off, you get digests in MIME format, which are much better if you -have a mail reader that supports MIME.""", + 'hide' : _('When turned on, your email address is concealed\n' + 'on the Web page that lists the members of the mailing list.'), + 'nomail' : _('When turned on, delivery to your email address is disabled,\n' + ' but your address is still subscribed. This is useful if you plan on\n' + ' taking a short vacation.'), + 'ack' : _('When turned on, you get a separate acknowledgement email\n' + 'when you post messages to the list.'), + 'notmetoo': _('When turned on, you do *not* get copies of your own\n' + 'posts to the list. Otherwise, you do get copies of your own posts\n' + ' (yes, this seems a little backwards). This does not affect the contents\n' + 'of digests, so if you receive postings in digests, you will always get\n' + 'copies of your messages in the digest.'), + 'digest' : _('When turned on, you get postings from the list bundled\n' + 'into digests. Otherwise, you get each individual message immediately as\n' + 'it is posted to the list.'), + 'plain' : _("When turned on, you get `plain' digests, which are actually\n" + "formatted using the older RFC934 digest format. This format can be easier\n" + "to read if you have a non-MIME compliant mail reader. When this option is\n" + "turned off, you get digests in MIME format, which are much better if you\n" + "have a mail reader that supports MIME."), } option_info = {'digest' : 0, @@ -165,13 +166,13 @@ class MailCommandHandler: if mo: lines = ["confirm %s" % (mo.group(1))] else: - self.AddError('Subject line ignored:\n ' + subject) + self.AddError(_('Subject line ignored:\n ') + subject) processed = {} # For avoiding redundancies. maxlines = mm_cfg.DEFAULT_MAIL_COMMANDS_MAX_LINES for linecount in range(len(lines)): if linecount > maxlines: - self.AddError("Maximum command lines (%d) encountered," - " ignoring the rest..." % maxlines) + self.AddError(_("Maximum command lines (%d) encountered," + " ignoring the rest...") % maxlines) for line in lines[linecount:]: self.AddToResponse("> " + line, trunc=0) break @@ -186,16 +187,16 @@ class MailCommandHandler: cmd = mo.group('cmd') args = args[1:] if cmd in ['end', '--']: - self.AddToResponse('\n***** End: ' + line + '\n' - 'The rest of the message is ignored:') + self.AddToResponse('\n***** ' + _('End: ') + line + '\n' + + _('The rest of the message is ignored:')) for line in lines[linecount+1:]: self.AddToResponse(line, trunc=0, prefix='> ') break if not self.__dispatch.has_key(cmd): - self.AddError(line, prefix='Command? ') + self.AddError(line, prefix=_('Command? ')) if self.__errors >= MAXERRORS: - self.AddError('\nToo many errors encountered; ' - 'the rest of the message is ignored:') + self.AddError(_('\nToo many errors encountered; ' + 'the rest of the message is ignored:')) for line in lines[linecount+1:]: self.AddToResponse(line, trunc=0, prefix='> ') break @@ -226,25 +227,25 @@ class MailCommandHandler: sfp = StringIO() traceback.print_exc(file=sfp) tbmsg = sfp.getvalue() - errmsg = Utils.wrap('''\ + errmsg = Utils.wrap(_('''\ An unexpected Mailman error has occurred. Please forward your request to the human list administrator in charge of this list at <%s>. The traceback is attached below and will be forwarded to the -list administrator automatically.''' % admin) +list administrator automatically.''') % admin) self.AddError(errmsg, trunc=0) self.AddToResponse('\n' + tbmsg, trunc=0) # log it to the error file syslog('error', - 'Unexpected Mailman error:\n%s' % tbmsg) + _('Unexpected Mailman error:\n%s') % tbmsg) # and send the traceback to the user responsemsg = Message.UserNotification( admin, admin, 'Unexpected Mailman error', - '''\ + _('''\ An unexpected Mailman error has occurred in MailCommandHandler.ParseMailCommands(). Here is the traceback: -''' + tbmsg) +''') + tbmsg) responsemsg['X-No-Archive'] = 'yes' # TBD: This should check the return value HandlerAPI.DeliverToUser(self, responsemsg) @@ -254,7 +255,7 @@ MailCommandHandler.ParseMailCommands(). Here is the traceback: adminaddr = self.GetAdminEmail() requestaddr = self.GetRequestEmail() if self.__errors > 0: - header = Utils.wrap('''This is an automated response. + header = Utils.wrap(_('''This is an automated response. There were problems with the email commands you sent to Mailman via the administrative address <%(sender)s>. @@ -268,12 +269,12 @@ send your message to <%(admin)s>. The following is a detailed description of the problems. -''' % {'sender': requestaddr, +''') % {'sender': requestaddr, 'admin' : adminaddr, }) self.__respbuf = header + self.__respbuf # send the response - subject = 'Mailman results for %s' % self.real_name + subject = _('Mailman results for %s') % self.real_name responsemsg = Message.UserNotification(msg.GetSender(), self.GetRequestEmail(), subject, @@ -286,39 +287,39 @@ The following is a detailed description of the problems. def ProcessPasswordCmd(self, args, cmd, mail): if len(args) not in [0,2]: - self.AddError("Usage: password [ ]") + self.AddError(_("Usage: password [ ]")) return sender = mail.GetSender() if len(args) == 0: # Mail user's password to user user = self.FindUser(sender) if user and self.passwords.has_key(user): - self.AddToResponse("You are subscribed as %s,\n" - " with password: %s" % + self.AddToResponse(_("You are subscribed as %s,\n" + " with password: %s") % (user, self.passwords[user]), trunc=0) else: - self.AddError("Found no password for %s" %sender, trunc=0) + self.AddError(_("Found no password for %s") %sender, trunc=0) return # Try to change password try: self.ConfirmUserPassword(sender, args[0]) self.ChangeUserPassword(sender, args[1], args[1]) - self.AddToResponse('Succeeded.') + self.AddToResponse(_('Succeeded.')) except Errors.MMListNotReadyError: - self.AddError("List is not functional.") + self.AddError(_("List is not functional.")) except Errors.MMNotAMemberError: - self.AddError("%s isn't subscribed to this list." % sender, + self.AddError(_("%s isn't subscribed to this list.") % sender, trunc=0) except Errors.MMBadPasswordError: - self.AddError("You gave the wrong password.") + self.AddError(_("You gave the wrong password.")) except Errors.MMBadUserError: - self.AddError("Bad user - %s." % sender, trunc=0) + self.AddError(_("Bad user - %s.") % sender, trunc=0) def ProcessOptionsCmd(self, args, cmd, mail): sender = self.FindUser(mail.GetSender()) if not sender: - self.AddError("%s is not a member of the list." % + self.AddError(_("%s is not a member of the list.") % mail.GetSender(), trunc=0) return for option in options: @@ -327,15 +328,15 @@ The following is a detailed description of the problems. else: value = 'off' self.AddToResponse('%8s: %s' % (option, value)) - self.AddToResponse("\n" + self.AddToResponse(_("\n" "To change an option, do: " "set