diff roundup-mailgw @ 485:fad315a10185

i18n'ification
author Richard Jones <richard@users.sourceforge.net>
date Sat, 05 Jan 2002 02:22:32 +0000
parents 141aacfdb34f
children ade1e4bfefc9
line wrap: on
line diff
--- a/roundup-mailgw	Sat Jan 05 02:11:22 2002 +0000
+++ b/roundup-mailgw	Sat Jan 05 02:22:32 2002 +0000
@@ -16,7 +16,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: roundup-mailgw,v 1.18 2001-12-13 00:20:01 richard Exp $
+# $Id: roundup-mailgw,v 1.19 2002-01-05 02:19:03 richard Exp $
 
 # python version check
 from roundup import version_check
@@ -24,6 +24,7 @@
 import sys, os, re, cStringIO
 
 from roundup.mailgw import Message
+from roundup.i18n import _
 
 def do_pipe(handler):
     '''Read a message from standard input and pass it to the mail handler.
@@ -64,7 +65,7 @@
     '''
     import getpass, poplib
     if not user:
-        user = raw_input('User: ')
+        user = raw_input(_('User: '))
     if not password:
         password = getpass.getpass()
 
@@ -92,8 +93,8 @@
 def usage(args, message=None):
     if message is not None:
         print message
-    print 'Usage: %s <instance home> [source spec]'%args[0]
-    print '''
+    print _('Usage: %(program)s <instance home> [source spec]')%{'program': args[0]}
+    print _('''
 The roundup mail gateway may be called in one of two ways:
  . with an instance home as the only argument,
  . with both an instance home and a mail spool file, or
@@ -120,7 +121,7 @@
     pop server
  are both valid. The username and/or password will be prompted for if
  not supplied on the command-line.
-'''
+''')
     return 1
 
 def main(args):
@@ -148,7 +149,7 @@
 
     # otherwise, figure what sort of mail source to handle
     if len(args) < 4:
-        return usage(args, 'Error: not enough source specification information')
+        return usage(args, _('Error: not enough source specification information'))
     source, specification = args[2:]
     if source == 'mailbox':
         return do_mailbox(handler, specification)
@@ -158,9 +159,9 @@
         if m:
             return do_pop(handler, m.group('server'), m.group('user'),
                 m.group('pass'))
-        return usage(args, 'Error: pop specification not valid')
+        return usage(args, _('Error: pop specification not valid'))
 
-    return usage(args, 'Error: The source must be either "mailbox" or "pop"')
+    return usage(args, _('Error: The source must be either "mailbox" or "pop"'))
 
 # call main
 if __name__ == '__main__':
@@ -168,6 +169,10 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.18  2001/12/13 00:20:01  richard
+#  . Centralised the python version check code, bumped version to 2.1.1 (really
+#    needs to be 2.1.2, but that isn't released yet :)
+#
 # Revision 1.17  2001/12/02 05:06:16  richard
 # . We now use weakrefs in the Classes to keep the database reference, so
 #   the close() method on the database is no longer needed.

Roundup Issue Tracker: http://roundup-tracker.org/