Index: pykota/trunk/pykota/tool.py
===================================================================
--- pykota/trunk/pykota/tool.py (revision 764)
+++ pykota/trunk/pykota/tool.py (revision 772)
@@ -15,4 +15,7 @@
 #
 # $Log$
+# Revision 1.16  2003/02/09 12:56:53  jalet
+# Internationalization begins...
+#
 # Revision 1.15  2003/02/08 22:09:52  jalet
 # Name check method moved here
@@ -70,4 +73,6 @@
 import getopt
 import smtplib
+import gettext
+from locale import setlocale, LC_ALL
 
 from mx import DateTime
@@ -88,4 +93,9 @@
     def __init__(self, isfilter=0, doc="PyKota %s (c) 2003 %s" % (version.__version__, version.__author__)) :
         """Initializes the command line tool."""
+        # locale stuff
+        setlocale(LC_ALL, "")
+        gettext.install("pykota")
+    
+        # pykota specific stuff
         self.documentation = doc
         self.config = config.PyKotaConfig(os.environ.get("CUPS_SERVERROOT", "/etc/cups"))
Index: pykota/trunk/bin/warnpykota
===================================================================
--- pykota/trunk/bin/warnpykota (revision 751)
+++ pykota/trunk/bin/warnpykota (revision 772)
@@ -17,4 +17,7 @@
 #
 # $Log$
+# Revision 1.6  2003/02/09 12:56:53  jalet
+# Internationalization begins...
+#
 # Revision 1.5  2003/02/07 23:24:38  jalet
 # Empty line deleted
@@ -100,5 +103,5 @@
         printernames = self.storage.getMatchingPrinters(options["printer"])
         if not printernames :
-            raise PyKotaToolError, "There's no printer matching %s" % options["printer"]
+            raise PyKotaToolError, _("There's no printer matching %s") % options["printer"]
         for printer in printernames :
             if options["users"] :
@@ -137,9 +140,9 @@
             sender.display_version_and_quit()
         elif options["users"] and options["groups"] :    
-            raise PyKotaToolError, "warnpykota: options --users and --groups are incompatible."
+            raise PyKotaToolError, _("warnpykota: options --users and --groups are incompatible.")
         elif options["groups"] :    
-            raise PyKotaToolError, "warnpykota: options --groups is currently not implemented."
+            raise PyKotaToolError, _("warnpykota: options --groups is currently not implemented.")
         elif args :    
-            raise PyKotaToolError, "warnpykota: unused arguments [%s]. Aborting." % ", ".join(args)
+            raise PyKotaToolError, _("warnpykota: unused arguments [%s]. Aborting.") % ", ".join(args)
         else :
             sys.exit(sender.main(options))
Index: pykota/trunk/bin/edpykota
===================================================================
--- pykota/trunk/bin/edpykota (revision 769)
+++ pykota/trunk/bin/edpykota (revision 772)
@@ -17,4 +17,7 @@
 #
 # $Log$
+# Revision 1.18  2003/02/09 12:56:53  jalet
+# Internationalization begins...
+#
 # Revision 1.17  2003/02/08 22:47:23  jalet
 # Option --reset can now be used without having to use soft and hard limits
@@ -173,7 +176,7 @@
                     printernames = [ pname ]
                 else :    
-                    raise PyKotaToolError, "Invalid printer name %s" % pname
+                    raise PyKotaToolError, _("Invalid printer name %s") % pname
             else :
-                raise PyKotaToolError, "There's no printer matching %s" % pname
+                raise PyKotaToolError, _("There's no printer matching %s") % pname
         softlimit = hardlimit = None    
         if options["softlimit"] :
@@ -181,13 +184,13 @@
                 softlimit = int(options["softlimit"].strip())
             except ValueError :    
-                raise PyKotaToolError, "Invalid softlimit value %s." % options["softlimit"]
+                raise PyKotaToolError, _("Invalid softlimit value %s.") % options["softlimit"]
         if options["hardlimit"] :
             try :
                 hardlimit = int(options["hardlimit"].strip())
             except ValueError :    
-                raise PyKotaToolError, "Invalid hardlimit value %s." % options["hardlimit"]
+                raise PyKotaToolError, _("Invalid hardlimit value %s.") % options["hardlimit"]
         if (softlimit is not None) and (hardlimit is not None) and (hardlimit < softlimit) :        
             # error, exchange them
-            self.logger.log_message("Hard limit %i is less than soft limit %i, values will be exchanged." % (hardlimit, softlimit), "warn")
+            self.logger.log_message(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit), "warn")
             (softlimit, hardlimit) = (hardlimit, softlimit)
         for printer in printernames :
@@ -198,5 +201,5 @@
                     prototype = self.storage.getGroupPQuota(options["prototype"], printer)
                 if prototype is None :
-                    self.logger.log_message("Prototype %s not found in Quota Storage for printer %s." % (options["prototype"], printer))
+                    self.logger.log_message(_("Prototype %s not found in Quota Storage for printer %s.") % (options["prototype"], printer))
                     continue    # skip this printer
                 else :    
@@ -204,10 +207,10 @@
             if hardlimit is None :    
                 hardlimit = softlimit
-                self.logger.log_message("Undefined hard limit set to soft limit (%s) on printer %s." % (str(hardlimit), printer))
+                self.logger.log_message(_("Undefined hard limit set to soft limit (%s) on printer %s.") % (str(hardlimit), printer))
             if softlimit is None :    
                 softlimit = hardlimit
-                self.logger.log_message("Undefined soft limit set to hard limit (%s) on printer %s." % (str(softlimit), printer))
+                self.logger.log_message(_("Undefined soft limit set to hard limit (%s) on printer %s.") % (str(softlimit), printer))
             if (not options["reset"]) and ((hardlimit is None) or (softlimit is None)) :        
-                raise PyKotaToolError, "Both hard and soft limits must be set ! Aborting."
+                raise PyKotaToolError, _("Both hard and soft limits must be set ! Aborting.")
             for name in names :
                 if options["users"] :
@@ -227,5 +230,5 @@
                                 quota = self.storage.getUserPQuota(name, printer)
                             else :    
-                                self.logger.log_message("Invalid user name %s" % name)
+                                self.logger.log_message(_("Invalid user name %s") % name)
                         else :
                             if self.isValidName(name) :
@@ -233,7 +236,7 @@
                                 quota = self.storage.getGroupPQuota(name, printer)
                             else :    
-                                self.logger.log_message("Invalid group name %s" % name)
+                                self.logger.log_message(_("Invalid group name %s") % name)
                 if quota is None :     
-                    self.logger.log_message("Quota not found for object %s on printer %s." % (name, printer))
+                    self.logger.log_message(_("Quota not found for object %s on printer %s.") % (name, printer))
                 else :    
                     if options["users"] :
@@ -281,9 +284,9 @@
             editor.display_version_and_quit()
         elif options["users"] and options["groups"] :    
-            raise PyKotaToolError, "edpykota: options --users and --groups are incompatible."
+            raise PyKotaToolError, _("edpykota: options --users and --groups are incompatible.")
         elif (options["softlimit"] or options["hardlimit"]) and options["prototype"] :    
-            raise PyKotaToolError, "edpykota: options --softlimit or --hardlimit and --prototype are incompatible."
+            raise PyKotaToolError, _("edpykota: options --softlimit or --hardlimit and --prototype are incompatible.")
         elif options["groups"] :    
-            raise PyKotaToolError, "edpykota: options --groups is currently not implemented."
+            raise PyKotaToolError, _("edpykota: options --groups is currently not implemented.")
         else :
             sys.exit(editor.main(args, options))
Index: pykota/trunk/bin/pykota
===================================================================
--- pykota/trunk/bin/pykota (revision 740)
+++ pykota/trunk/bin/pykota (revision 772)
@@ -17,4 +17,7 @@
 #
 # $Log$
+# Revision 1.8  2003/02/09 12:56:53  jalet
+# Internationalization begins...
+#
 # Revision 1.7  2003/02/07 10:23:48  jalet
 # Avoid a possible future name clash
@@ -75,8 +78,8 @@
         else :    
             infile = sys.stdin
-        data = infile.read(65536)    
+        data = infile.read(256*1024)    
         while data :
             sys.stdout.write(data)
-            data = infile.read(65536)
+            data = infile.read(256*1024)
         if mustclose :    
             infile.close()
@@ -112,5 +115,5 @@
         # The printer is unknown from the Quota Storage perspective
         # we let the job pass through, but log a warning message
-        kotafilter.logger.log_message("Printer %s not registered in the PyKota system" % kotafilter.printername, "warn")
+        kotafilter.logger.log_message(_("Printer %s not registered in the PyKota system") % kotafilter.printername, "warn")
     else :    
         (lastpagecounter, lastusername) = (pgc["pagecounter"], pgc["lastusername"])
@@ -135,5 +138,5 @@
             kotafilter.warnUserPQuota(lastusername)
         else :    
-            kotafilter.logger.log_message("Error in page count value %i for user %s on printer %s" % (jobsize, kotafilter.printername, lastusername), "error")
+            kotafilter.logger.log_message(_("Error in page count value %i for user %s on printer %s") % (jobsize, kotafilter.printername, lastusername), "error")
         
     # pass the job untouched to the underlying layer
Index: pykota/trunk/bin/repykota
===================================================================
--- pykota/trunk/bin/repykota (revision 770)
+++ pykota/trunk/bin/repykota (revision 772)
@@ -17,4 +17,7 @@
 #
 # $Log$
+# Revision 1.8  2003/02/09 12:56:53  jalet
+# Internationalization begins...
+#
 # Revision 1.7  2003/02/08 23:17:20  jalet
 # repykota now outputs life time page counters and the total pages printed by
@@ -102,11 +105,11 @@
         printernames = self.storage.getMatchingPrinters(options["printer"])
         if not printernames :
-            raise PyKotaToolError, "There's no printer matching %s" % options["printer"]
+            raise PyKotaToolError, _("There's no printer matching %s") % options["printer"]
         for printer in printernames :
-            print "*** Report for %s quota on printer %s" % ((options["users"] and "user") or "group", printer)
-            print "Pages grace time: %idays" % self.config.getGraceDelay()
+            print _("*** Report for %s quota on printer %s") % ((options["users"] and "user") or "group", printer)
+            print _("Pages grace time: %idays") % self.config.getGraceDelay()
             total = 0
             if options["users"] :
-                print "User             used     soft     hard   grace        total"
+                print _("User             used     soft     hard   grace        total")
                 print "------------------------------------------------------------"
                 for name in self.storage.getPrinterUsers(printer) :
@@ -114,5 +117,5 @@
                     total += self.printQuota(name, quota)
             else :
-                print "Group            used     soft     hard   grace        total"
+                print _("Group            used     soft     hard   grace        total")
                 print "------------------------------------------------------------"
                 for name in self.storage.getPrinterGroups(printer) :
@@ -171,9 +174,9 @@
             reporter.display_version_and_quit()
         elif options["users"] and options["groups"] :    
-            raise PyKotaToolError, "repykota: options --users and --groups are incompatible."
+            raise PyKotaToolError, _("repykota: options --users and --groups are incompatible.")
         elif options["groups"] :    
-            raise PyKotaToolError, "repykota: options --groups is currently not implemented."
+            raise PyKotaToolError, _("repykota: options --groups is currently not implemented.")
         elif args :    
-            raise PyKotaToolError, "repykota: unused arguments [%s]. Aborting." % ", ".join(args)
+            raise PyKotaToolError, _("repykota: unused arguments [%s]. Aborting.") % ", ".join(args)
         else :
             sys.exit(reporter.main(options))
