Re: [PATCH 2/2] Internationalize all appropriate strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel P. Berrange wrote:
> 
> This all looks correct to me.
> 
> Dan.

This patch had to be updated as well to accommodate the previous gettext
changes.

Thanks,
Cole

-- 
Cole Robinson
crobinso@xxxxxxxxxx
diff -r 77f6b840cf40 virt-clone
--- a/virt-clone	Wed Jul 04 10:39:57 2007 -0400
+++ b/virt-clone	Fri Jul 06 14:27:18 2007 -0400
@@ -29,6 +29,13 @@ import virtinst
 import virtinst
 import virtinst.CloneManager as clmgr
 
+import gettext
+import locale
+
+locale.setlocale(locale.LC_ALL, '')
+gettext.bindtextdomain(virtinst.gettext_app, virtinst.gettext_dir)
+gettext.install(virtinst.gettext_app, virtinst.gettext_dir)
+
 MIN_RAM = 256
 MAX_LOGSIZE   = 1024 * 1024  # 1MB
 ROTATE_NUM    = 5
@@ -45,7 +52,7 @@ if not os.access(vi_dir,os.W_OK):
     try:
         os.mkdir(vi_dir)
     except IOError, e:
-        raise RuntimeError, "Could not create %d directory: " % vi_dir, e
+        raise RuntimeError, _("Could not create %d directory: ") % vi_dir, e
 
 filename = "%s/%s" % (vi_dir, FILE_NAME)
 rootLogger = logging.getLogger()
@@ -65,22 +72,22 @@ def prompt_for_input(prompt = "", val = 
 ### General input gathering functions
 def get_clone_name(new_name, design):
     while 1:
-        new_name = prompt_for_input("What is the name for the cloned virtual machine?", new_name)
+        new_name = prompt_for_input(_("What is the name for the cloned virtual machine?"), new_name)
         try:
             design.clone_name = new_name
             break
         except (ValueError, RuntimeError), e:
-            print "ERROR: ", e
+            print _("ERROR: "), e
             new_name = None
 
 def get_original_guest(guest, design):
     while 1:
-        guest = prompt_for_input("What is the name or uuid of the original virtual machine?", guest)
+        guest = prompt_for_input(_("What is the name or uuid of the original virtual machine?"), guest)
         try:
             design.original_guest = guest
             break
         except (ValueError, RuntimeError), e:
-            print "ERROR: ", e
+            print _("ERROR: "), e
             guest = None
 
 def get_clone_macaddr(new_mac, design):
@@ -98,7 +105,7 @@ def get_clone_uuid(new_uuid, design):
 
 def get_clone_diskfile(new_diskfile, design):
     if new_diskfile is None:
-        raise ValueError, "A new disk image file for the cloned guest is required"
+        raise ValueError, _("A new disk image file for the cloned guest is required")
     for i in new_diskfile:
         design.set_clone_devices(i) 
 
@@ -119,12 +126,12 @@ def get_force_target(target, design):
 ### Option parsing
 def check_before_store(option, opt_str, value, parser):
     if len(value) == 0:
-        raise OptionValueError, "%s option requires an argument" %opt_str
+        raise OptionValueError, _("%s option requires an argument") %opt_str
     setattr(parser.values, option.dest, value)
 
 def check_before_append(option, opt_str, value, parser):
     if len(value) == 0:
-        raise OptionValueError, "%s option requires an argument" %opt_str
+        raise OptionValueError, _("%s option requires an argument") %opt_str
     parser.values.ensure_value(option.dest, []).append(value)
 
 def parse_args():
@@ -133,50 +140,50 @@ def parse_args():
     # original name
     parser.add_option("-o", "--original", type="string", dest="original_guest",
                       action="callback", callback=check_before_store,
-                      help="Name or uuid for the original guest; The status must be shut off")
+                      help=_("Name or uuid for the original guest; The status must be shut off"))
     # clone new name
     parser.add_option("-n", "--name", type="string", dest="new_name",
                       action="callback", callback=check_before_store,
-                      help="New name for the clone guest")
+                      help=_("Name for the new guest"))
 
     # clone new uuid
     parser.add_option("-u", "--uuid", type="string",
                       dest="new_uuid", action="callback", callback=check_before_store,
-                      help="New UUID for the clone guest; if none is given a random UUID will be generated")
+                      help=_("New UUID for the clone guest; Default is a randomly generated UUID"))
 
     # clone new macs
     parser.add_option("-m", "--mac", type="string",
                       dest="new_mac", action="callback", callback=check_before_append,
-                      help="New fixed MAC address for the clone guest; if none or RANDOM is given a random address will be used")
+                      help=_("New fixed MAC address for the clone guest. Default is a randomly generated MAC"))
 
     # clone new disks 
     parser.add_option("-f", "--file", type="string",
                       dest="new_diskfile", action="callback", callback=check_before_append,
-                      help="New file to use as the disk image for the clone guest")
+                      help=_("New file to use as the disk image for the new guest"))
     # connect
     parser.add_option("", "--connect", type="string",
                       dest="connect", action="callback", callback=check_before_store,
-                      help="Connect to hypervisor with URI",
+                      help=_("Connect to hypervisor with URI"),
                       default=virtinst.util.default_connection())
 
     # target
     parser.add_option("", "--force-copy", type="string",
                       dest="target", action="callback", callback=check_before_append,
-                      help="Force to copy devices (eg, if 'hdc' is a readonly cdrom device or shareable any devices, --force-copy=hdc)")
+                      help=_("Force to copy devices (eg, if 'hdc' is a readonly cdrom device, --force-copy=hdc)"))
 
     # non sparse
     parser.add_option("", "--nonsparse", action="store_false",
                       default=True, dest="sparse",
-                      help="Don't use sparse files for the disk images for the clone guest")
+                      help=_("Do not use a sparse file for the clone's disk image"))
 
     # preserve
     parser.add_option("", "--preserve-data", action="store_false",
                       default=True, dest="preserve",
-                      help="Preserve a new file to use as the disk image for the clone guest")
+                      help=_("Preserve a new file to use as the disk image for the new guest"))
 
     # Misc options
     parser.add_option("-d", "--debug", action="store_true", dest="debug",
-                      help="Print debugging information") 
+                      help=_("Print debugging information"))
 
     (options,args) = parser.parse_args()
     return options
@@ -197,7 +204,7 @@ def main():
 
     if options.connect is None or options.connect.lower()[0:3] == "xen":
         if os.geteuid() != 0:
-            print >> sys.stderr, "Must be root to clone Xen guests"
+            print >> sys.stderr, _("Must be root to clone Xen guests")
             sys.exit(1)
 
     conn = libvirt.open(options.connect)
diff -r 77f6b840cf40 virt-install
--- a/virt-install	Wed Jul 04 10:39:57 2007 -0400
+++ b/virt-install	Fri Jul 06 14:27:36 2007 -0400
@@ -25,6 +25,13 @@ import libvirt
 import libvirt
 import virtinst
 
+import gettext
+import locale
+
+locale.setlocale(locale.LC_ALL, '')
+gettext.bindtextdomain(virtinst.gettext_app, virtinst.gettext_dir)
+gettext.install(virtinst.gettext_app, virtinst.gettext_dir)
+
 MIN_RAM = 256
 MAX_LOGSIZE   = 1024 * 1024  # 1MB
 ROTATE_NUM    = 5
@@ -41,7 +48,7 @@ if not os.access(vi_dir,os.W_OK):
     try:
         os.mkdir(vi_dir)
     except IOError, e:
-        raise RuntimeError, "Could not create %d directory: " % vi_dir, e
+        raise RuntimeError, _("Could not create %d directory: ") % vi_dir, e
 
 filename = "%s/%s" % (vi_dir, FILE_NAME)
 rootLogger = logging.getLogger()
@@ -49,6 +56,8 @@ fileHandler = logging.handlers.RotatingF
 fileHandler = logging.handlers.RotatingFileHandler(filename, FILE_MODE, MAX_LOGSIZE, ROTATE_NUM)
 fileHandler.setFormatter(logging.Formatter(FILE_FORMAT, DATEFMT))
 rootLogger.addHandler(fileHandler)
+
+errstr = _("ERROR: ")
 
 ### Utility functions
 def yes_or_no(s):
@@ -57,7 +66,7 @@ def yes_or_no(s):
         return True
     elif s in ("n", "no", "0", "false", "f"):
         return False
-    raise ValueError, "A yes or no response is required" 
+    raise ValueError, _("A yes or no response is required")
 
 def prompt_for_input(prompt = "", val = None):
     if val is not None:
@@ -69,35 +78,35 @@ def prompt_for_input(prompt = "", val = 
 ### General input gathering functions
 def get_full_virt():
     while 1:
-        res = prompt_for_input("Would you like a fully virtualized guest (yes or no)?  This will allow you to run unmodified operating systems.")
+        res = prompt_for_input(_("Would you like a fully virtualized guest (yes or no)?  This will allow you to run unmodified operating systems."))
         try:
             return yes_or_no(res)
         except ValueError, e:
-            print "ERROR: ", e
+            print errstr, e
 
 def get_name(name, guest):
     while 1:
-        name = prompt_for_input("What is the name of your virtual machine?", name)
+        name = prompt_for_input(_("What is the name of your virtual machine?"), name)
         try:
             guest.name = name
             break
         except ValueError, e:
-            print "ERROR: ", e            
+            print errstr, e            
             name = None
 
 def get_memory(memory, guest):
     while 1:
         try:
-            memory = int(prompt_for_input("How much RAM should be allocated (in megabytes)?", memory))
+            memory = int(prompt_for_input(_("How much RAM should be allocated (in megabytes)?"), memory))
             if memory < MIN_RAM:
-                print "ERROR: Installs currently require %d megs of RAM." %(MIN_RAM,)
+                print _("ERROR: Installs currently require %d megs of RAM.") %(MIN_RAM,)
                 print ""
                 memory = None
                 continue
             guest.memory = memory
             break
         except ValueError, e:
-            print "ERROR: ", e
+            print errstr, e
             memory = None
 
 def get_uuid(uuid, guest):
@@ -105,7 +114,7 @@ def get_uuid(uuid, guest):
         try:
             guest.uuid = uuid
         except ValueError, e:
-            print "ERROR: ", e
+            print errstr, e
             sys.exit(1)
 
 def get_vcpus(vcpus, check_cpu, guest, conn):
@@ -116,36 +125,36 @@ def get_vcpus(vcpus, check_cpu, guest, c
         cpu_num = hostinfo[4] * hostinfo[5] * hostinfo[6] * hostinfo[7]
         if vcpus <= cpu_num:
             break
-        res = prompt_for_input("You have asked for more virtual CPUs (%d) than there are physical CPUs (%d) on the host. This will work, but performance will be poor. Are you sure? (yes or no)" %(vcpus, cpu_num))
+        res = prompt_for_input(_("You have asked for more virtual CPUs (%(vcpu)d) than there are physical CPUs (%(phys)d) on the host. This will work, but performance will be poor. Are you sure? (yes or no)") % {'vcpu' : vcpus, 'phys' : cpu_num})
         try:
             if yes_or_no(res):
                 break
-            vcpus = int(prompt_for_input("How many VCPUs should be attached?"))
-        except ValueError, e:
-            print "ERROR: ", e
+            vcpus = int(prompt_for_input(_("How many VCPUs should be attached?")))
+        except ValueError, e:
+            print errstr, e
     if vcpus:
         try:
             guest.vcpus = vcpus
         except ValueError, e:
-            print "ERROR: ", e
+            print errstr, e
             
 
 def get_disk(disk, size, sparse, guest, hvm, conn):
     # FIXME: need to handle a list of disks at some point
     while 1:
-        msg = "What would you like to use as the disk (path)?"
+        msg = _("What would you like to use as the disk (path)?")
         if not size is None:
-            msg = "Please enter the path to the file you would like to use for storage. It will have size %sGB." %(size,)
+            msg = _("Please enter the path to the file you would like to use for storage. It will have size %sGB.") %(size,)
         disk = prompt_for_input(msg, disk)
         while 1:
             if os.path.exists(disk):
                 break
-            size = prompt_for_input("How large would you like the disk (%s) to be (in gigabytes)?" %(disk,), size)
+            size = prompt_for_input(_("How large would you like the disk (%s) to be (in gigabytes)?") %(disk,), size)
             try:
                 size = float(size)
                 break
             except Exception, e:
-                print "ERROR: ", e
+                print errstr, e
                 size = None
 
         try:
@@ -153,8 +162,8 @@ def get_disk(disk, size, sparse, guest, 
             if d.is_conflict_disk(conn) is True:
                 while 1:
                     retryFlg = False
-                    warnmsg = "Disk %s is already in use by another guest!" % disk
-                    res = prompt_for_input(warnmsg + "  Do you really want to use the disk (yes or no)? ")
+                    warnmsg = _("Disk %s is already in use by another guest!") % disk
+                    res = prompt_for_input(warnmsg + _("  Do you really want to use the disk (yes or no)? "))
                     try:
                         if yes_or_no(res) is True:
                             break
@@ -162,7 +171,7 @@ def get_disk(disk, size, sparse, guest, 
                             retryFlg = True
                             break
                     except ValueError, e:
-                        print "ERROR: ", e
+                        print errstr, e
                         continue
                 if retryFlg is True:
                     disk = size = None
@@ -170,7 +179,7 @@ def get_disk(disk, size, sparse, guest, 
             if d.type == virtinst.VirtualDisk.TYPE_FILE and not(hvm) and virtinst.util.is_blktap_capable():
                 d.driver_name = virtinst.VirtualDisk.DRIVER_TAP
         except ValueError, e:
-            print "ERROR: ", e
+            print errstr, e
             disk = size = None
             continue
 
@@ -180,12 +189,12 @@ def get_disks(disk, size, sparse, nodisk
 def get_disks(disk, size, sparse, nodisks, guest, hvm, conn):
     if nodisks:
         if disk or size:
-            raise ValueError, "Cannot use --file with --nodisks"
+            raise ValueError, _("Cannot use --file with --nodisks")
         return
     # ensure we have equal length lists 
     if (type(disk) == type(size) == list):
         if len(disk) != len(size):
-            print >> sys.stderr, "Need to pass size for each disk"
+            print >> sys.stderr, _("Need to pass size for each disk")
             sys.exit(1)
     elif type(disk) == list:
         size = [ None ] * len(disk)
@@ -211,7 +220,7 @@ def get_network(mac, network, guest):
     elif network[0:7] == "network":
         n = virtinst.VirtualNetworkInterface(mac, type="network", network=network[8:])
     else:
-        print >> sys.stderr, "Unknown network type " + network
+        print >> sys.stderr, _("Unknown network type ") + network
         sys.exit(1)
     guest.nics.append(n)
 
@@ -226,7 +235,7 @@ def get_networks(macs, bridges, networks
         networks = [ networks ]
 
     if bridges is not None and networks != None:
-        print >> sys.stderr, "Cannot mix both --bridge and --network arguments"
+        print >> sys.stderr, _("Cannot mix both --bridge and --network arguments")
         sys.exit(1)
 
     # ensure we have equal length lists
@@ -236,7 +245,7 @@ def get_networks(macs, bridges, networks
     if networks != None:
         if macs != None:
             if len(macs) != len(networks):
-                print >> sys.stderr, "Need to pass equal numbers of networks & mac addresses"
+                print >> sys.stderr, _("Need to pass equal numbers of networks & mac addresses")
                 sys.exit(1)
         else:
             macs = [ None ] * len(networks)
@@ -248,7 +257,7 @@ def get_networks(macs, bridges, networks
             networks = ["user"]
         if macs != None:
             if len(macs) > 1:
-                print >> sys.stderr, "Need to pass equal numbers of networks & mac addresses"
+                print >> sys.stderr, _("Need to pass equal numbers of networks & mac addresses")
                 sys.exit(1)
         else:
             macs = [ None ]
@@ -257,11 +266,11 @@ def get_networks(macs, bridges, networks
 
 def get_graphics(vnc, vncport, nographics, sdl, keymap, guest):
     if vnc and nographics:
-        raise ValueError, "Can't do both VNC graphics and nographics"
+        raise ValueError, _("Can't do both VNC graphics and nographics")
     elif vnc and sdl:
-        raise ValueError, "Can't do both VNC graphics and SDL"
+        raise ValueError, _("Can't do both VNC graphics and SDL")
     elif sdl and nographics:
-        raise ValueError, "Can't do both SDL and nographics"
+        raise ValueError, _("Can't do both SDL and nographics")
     if nographics:
         guest.graphics = False
         return
@@ -272,11 +281,11 @@ def get_graphics(vnc, vncport, nographic
         guest.graphics = (True, "sdl")
         return
     while 1:
-        res = prompt_for_input("Would you like to enable graphics support? (yes or no)")
+        res = prompt_for_input(_("Would you like to enable graphics support? (yes or no)"))
         try:
             vnc = yes_or_no(res)
         except ValueError, e:
-            print "ERROR", e
+            print errstr, e
             continue
         if vnc:
             guest.graphics = (True, "vnc", vncport, keymap)
@@ -288,12 +297,12 @@ def get_graphics(vnc, vncport, nographic
 ### Paravirt input gathering functions
 def get_paravirt_install(src, guest):
     while 1:
-        src = prompt_for_input("What is the install location?", src)
+        src = prompt_for_input(_("What is the install location?"), src)
         try:
             guest.location = src
             break
         except ValueError, e:
-            print "ERROR: ", e
+            print errstr, e
             src = None
 
 def get_paravirt_extraargs(extra, guest):
@@ -306,122 +315,122 @@ def get_fullvirt_cdrom(cdpath, location,
         cdpath = location
 
     while 1:
-        cdpath = prompt_for_input("What is the virtual CD image, CD device or install location?", cdpath)
+        cdpath = prompt_for_input(_("What is the virtual CD image, CD device or install location?"), cdpath)
         try:
             guest.location = cdpath
             break
         except ValueError, e:
-            print "ERROR: ", e
+            print errstr, e
             cdpath = None
 
 ### Option parsing
 def check_before_store(option, opt_str, value, parser):
     if len(value) == 0:
-        raise OptionValueError, "%s option requires an argument" %opt_str
+        raise OptionValueError, _("%s option requires an argument") %opt_str
     setattr(parser.values, option.dest, value)
 
 def check_before_append(option, opt_str, value, parser):
     if len(value) == 0:
-        raise OptionValueError, "%s option requires an argument" %opt_str
+        raise OptionValueError, _("%s option requires an argument") %opt_str
     parser.values.ensure_value(option.dest, []).append(value)
 
 def parse_args():
     parser = OptionParser()
     parser.add_option("-n", "--name", type="string", dest="name",
                       action="callback", callback=check_before_store,
-                      help="Name of the guest instance")
+                      help=_("Name of the guest instance"))
     parser.add_option("-r", "--ram", type="int", dest="memory",
-                      help="Memory to allocate for guest instance in megabytes")
+                      help=_("Memory to allocate for guest instance in megabytes"))
     parser.add_option("-u", "--uuid", type="string", dest="uuid",
                       action="callback", callback=check_before_store,
-                      help="UUID for the guest; if none is given a random UUID will be generated. If you specify UUID, you should use a 32-digit hexadecimal number.")
+                      help=_("UUID for the guest; if none is given a random UUID will be generated. If you specify UUID, you should use a 32-digit hexadecimal number."))
     parser.add_option("", "--vcpus", type="int", dest="vcpus",
-                      help="Number of vcpus to configure for your guest")
+                      help=_("Number of vcpus to configure for your guest"))
     parser.add_option("", "--check-cpu", action="store_true", dest="check_cpu",
-                      help="Check that vcpus do not exceed physical CPUs and warn if they do.")
+                      help=_("Check that vcpus do not exceed physical CPUs and warn if they do."))
 
     # disk options
     parser.add_option("-f", "--file", type="string",
                       dest="diskfile", action="callback", callback=check_before_append,
-                      help="File to use as the disk image")
+                      help=_("File to use as the disk image"))
     parser.add_option("-s", "--file-size", type="float",
                       action="append", dest="disksize",
-                      help="Size of the disk image (if it doesn't exist) in gigabytes")
+                      help=_("Size of the disk image (if it doesn't exist) in gigabytes"))
     parser.add_option("", "--nonsparse", action="store_false",
                       default=True, dest="sparse",
-                      help="Don't use sparse files for disks.  Note that this will be significantly slower for guest creation")
+                      help=_("Don't use sparse files for disks.  Note that this will be significantly slower for guest creation"))
     parser.add_option("", "--nodisks", action="store_true",
-                      help="Don't set up any disks for the guest.")
+                      help=_("Don't set up any disks for the guest."))
     
     # network options
     parser.add_option("-m", "--mac", type="string",
                       dest="mac", action="callback", callback=check_before_append,
-                      help="Fixed MAC address for the guest; if none or RANDOM is given a random address will be used")
+                      help=_("Fixed MAC address for the guest; if none or RANDOM is given a random address will be used"))
     parser.add_option("-b", "--bridge", type="string",
                       dest="bridge", action="callback", callback=check_before_append,
-                      help="Bridge to connect guest NIC to; if none given, will try to determine the default")
+                      help=_("Bridge to connect guest NIC to; if none given, will try to determine the default"))
     parser.add_option("-w", "--network", type="string",
                       dest="network", action="callback", callback=check_before_append,
-                      help="Connect the guest to a virtual network, forwarding to the physical network with NAT")
+                      help=_("Connect the guest to a virtual network, forwarding to the physical network with NAT"))
 
     # graphics options
     parser.add_option("", "--vnc", action="store_true", dest="vnc", 
-                      help="Use VNC for graphics support")
+                      help=_("Use VNC for graphics support"))
     parser.add_option("", "--vncport", type="int", dest="vncport",
-                      help="Port to use for VNC")
+                      help=_("Port to use for VNC"))
     parser.add_option("", "--sdl", action="store_true", dest="sdl", 
-                      help="Use SDL for graphics support")
+                      help=_("Use SDL for graphics support"))
     parser.add_option("", "--nographics", action="store_true",
-                      help="Don't set up a graphical console for the guest.")
+                      help=_("Don't set up a graphical console for the guest."))
     parser.add_option("", "--noautoconsole",
                       action="store_false", dest="autoconsole",
-                      help="Don't automatically try to connect to the guest console")
+                      help=_("Don't automatically try to connect to the guest console"))
 
     parser.add_option("-k", "--keymap", type="string", dest="keymap",
                       action="callback", callback=check_before_store,
-                      help="set up keymap for a graphical console")
+                      help=_("set up keymap for a graphical console"))
 
     parser.add_option("", "--accelerate", action="store_true", dest="accelerate",
-                      help="Use kernel acceleration capabilities")
+                      help=_("Use kernel acceleration capabilities"))
     parser.add_option("", "--connect", type="string", dest="connect",
                       action="callback", callback=check_before_store,
-                      help="Connect to hypervisor with URI",
+                      help=_("Connect to hypervisor with URI"),
                       default=virtinst.util.default_connection())
     parser.add_option("", "--installer", type="string", dest="installer",
                       action="callback", callback=check_before_store,
-                      help="Specify the installation method to use e.g. 'distro', ...")
+                      help=_("Specify the installation method to use e.g. 'distro', ..."))
 
     # fullvirt options
     parser.add_option("-v", "--hvm", action="store_true", dest="fullvirt",
-                      help="This guest should be a fully virtualized guest")
+                      help=_("This guest should be a fully virtualized guest"))
     parser.add_option("-c", "--cdrom", type="string", dest="cdrom",
                       action="callback", callback=check_before_store,
-                      help="File to use a virtual CD-ROM device for fully virtualized guests")
+                      help=_("File to use a virtual CD-ROM device for fully virtualized guests"))
     parser.add_option("", "--os-type", type="string", dest="os_type",
                       action="callback", callback=check_before_store,
-                      help="The OS type for fully virtualized guests, e.g. 'linux', 'unix', 'windows'")
+                      help=_("The OS type for fully virtualized guests, e.g. 'linux', 'unix', 'windows'"))
     parser.add_option("", "--os-variant", type="string", dest="os_variant",
                       action="callback", callback=check_before_store,
-                      help="The OS variant for fully virtualized guests, e.g. 'fedora6', 'rhel5', 'solaris10', 'win2k', 'vista'")
-    parser.add_option("", "--noapic", action="store_true", dest="noapic", help="Disables APIC for fully virtualized guest (overrides value in os-type/os-variant db)", default=False)
-    parser.add_option("", "--noacpi", action="store_true", dest="noacpi", help="Disables ACPI for fully virtualized guest (overrides value in os-type/os-variant db)", default=False)
+                      help=_("The OS variant for fully virtualized guests, e.g. 'fedora6', 'rhel5', 'solaris10', 'win2k', 'vista'"))
+    parser.add_option("", "--noapic", action="store_true", dest="noapic", help=_("Disables APIC for fully virtualized guest (overrides value in os-type/os-variant db)"), default=False)
+    parser.add_option("", "--noacpi", action="store_true", dest="noacpi", help=_("Disables ACPI for fully virtualized guest (overrides value in os-type/os-variant db)"), default=False)
     parser.add_option("", "--arch", type="string", dest="arch",
                       action="callback", callback=check_before_store,
-                      help="The CPU architecture to simulate")
+                      help=_("The CPU architecture to simulate"))
     
     # paravirt options
     parser.add_option("-p", "--paravirt", action="store_false", dest="paravirt",
-                      help="This guest should be a paravirtualized guest")
+                      help=_("This guest should be a paravirtualized guest"))
     parser.add_option("-l", "--location", type="string", dest="location",
                       action="callback", callback=check_before_store,
-                      help="Installation source for paravirtualized guest (eg, nfs:host:/path, http://host/path, ftp://host/path)")
+                      help=_("Installation source for paravirtualized guest (eg, nfs:host:/path, http://host/path, ftp://host/path)"))
     parser.add_option("-x", "--extra-args", type="string",
                       dest="extra", default="",
-                      help="Additional arguments to pass to the installer with paravirt guests")
+                      help=_("Additional arguments to pass to the installer with paravirt guests"))
 
     # Misc options
     parser.add_option("-d", "--debug", action="store_true", dest="debug", 
-                      help="Print debugging information")
+                      help=_("Print debugging information"))
 
 
     (options,args) = parser.parse_args()
@@ -462,16 +471,17 @@ def vnc_console(dom):
         else:
             break
     if vncport == '-1' or vncport is None:
-        print >> sys.stderr, "Unable to connect to graphical console; vnc port number not found."
+        print >> sys.stderr, _("Unable to connect to graphical console; vnc port number not found.")
         return None
     vncport = int(vncport)
     vnchost = "localhost"
     if not os.path.exists("/usr/bin/vncviewer"):
-        print >> sys.stderr, "Unable to connect to graphical console; vncviewer not installed.  Please connect to %s:%d" %(vnchost, vncport)
+        print >> sys.stderr, _("Unable to connect to graphical console; vncviewer not installed.  Please connect to %(serv)s:%(port)d") % \
+            {'serv' : vnchost, 'port' : vncport}
         return None
     if not os.environ.has_key("DISPLAY"):
-        print >> sys.stderr, "Unable to connect to graphical console; DISPLAY is not set.  Please connect to %s:%d" %(vnchost, vncport)
-        return None
+        print >> sys.stderr, _("Unable to connect to graphical console; vncviewer not installed.  Please connect to %(serv)s:%(port)d") % \
+            {'serv' : vnchost, 'port' : vncport}
     logging.debug("VNC Port: %d; VNC host: %s" % (vncport, vnchost))
 
     child = os.fork()
@@ -514,7 +524,7 @@ def main():
 
     if options.connect is None or options.connect.lower()[0:3] == "xen":
         if os.geteuid() != 0:
-            print >> sys.stderr, "Must be root to clone Xen guests"
+            print >> sys.stderr, _("Must be root to clone Xen guests")
             sys.exit(1)
 
     conn = libvirt.open(options.connect)
@@ -527,13 +537,13 @@ def main():
         pv  = options.paravirt
         if virtinst.util.is_hvm_capable():
             if hvm is not None and pv is not None:
-                print >> sys.stderr, "Can't do both --hvm and --paravirt"
+                print >> sys.stderr, _("Can't do both --hvm and --paravirt")
                 sys.exit(1)
             elif pv is not None:
                 hvm = False
         else:
             if hvm is not None:
-                print >> sys.stderr, "Can't do --hvm to this system: HVM guest is not supported by your CPU or enabled in your BIOS"
+                print >> sys.stderr, _("Can't do --hvm on this system: HVM guest is not supported by your CPU or enabled in your BIOS")
                 sys.exit(1)
             else:
                 hvm = False
@@ -553,7 +563,7 @@ def main():
     elif options.installer == "livecd":
         installer = virtinst.LiveCDInstaller(type = type)
     else:
-        print >> sys.stderr, "Unknown installer type '%s'" % options.installer
+        print >> sys.stderr, _("Unknown installer type '%s'") % options.installer
         sys.exit(1)
 
     if hvm:
@@ -603,7 +613,7 @@ def main():
 
     # we've got everything -- try to start the install
     try:
-        print "\n\nStarting install..."
+        print _("\n\nStarting install...")
 
         started = False
         while True:
@@ -616,34 +626,27 @@ def main():
                 break
 
             if dom is None:
-                print "Guest installation failed"
+                print _("Guest installation failed")
                 sys.exit(0)
             elif dom.info()[0] != libvirt.VIR_DOMAIN_SHUTOFF:
                 # domain seems to be running
-                print "Domain installation still in progress.  You can reconnect "
-                print "to the console to complete the installation process."
+                print _("Domain installation still in progress.  You can reconnect to \nthe console to complete the installation process.")
                 sys.exit(0)
 
             if not started:
                 started = True
                 if not guest.post_install_check():
-                    print ("Domain installation does not appear to have been\n"
-                           "successful.  If it was, you can restart your domain\n"
-                           "by running 'virsh start %s'; otherwise, please\n"
-                           "restart your installation.") %(guest.name,)
+                    print _("Domain installation does not appear to have been\n successful.  If it was, you can restart your domain\n by running 'virsh start %s'; otherwise, please\n restart your installation.") %(guest.name,)
                     sys.exit(0)
 
-        print "Guest installation complete... restarting guest."
+        print _("Guest installation complete... restarting guest.")
         dom.create()
         guest.connect_console(conscb)
     except RuntimeError, e:
-        print >> sys.stderr, "ERROR: ", e
+        print >> sys.stderr, errstr, e
         sys.exit(1)
     except Exception, e:
-        print ("Domain installation may not have been\n"
-               "successful.  If it was, you can restart your domain\n"
-               "by running 'virsh start %s'; otherwise, please\n"
-               "restart your installation.") %(guest.name,)
+        print _("Domain installation may not have been\n successful.  If it was, you can restart your domain\n by running 'virsh start %s'; otherwise, please\n restart your installation.") %(guest.name,)
         raise
 
 if __name__ == "__main__":
diff -r 77f6b840cf40 virtinst/CapabilitiesParser.py
--- a/virtinst/CapabilitiesParser.py	Wed Jul 04 10:39:57 2007 -0400
+++ b/virtinst/CapabilitiesParser.py	Fri Jul 06 15:16:38 2007 -0400
@@ -13,6 +13,7 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 import libxml2
+from virtinst import _virtinst as _
 
 class CapabilitiesParserException(Exception):
     def __init__(self, msg):
diff -r 77f6b840cf40 virtinst/CloneManager.py
--- a/virtinst/CloneManager.py	Wed Jul 04 10:39:57 2007 -0400
+++ b/virtinst/CloneManager.py	Fri Jul 06 15:21:58 2007 -0400
@@ -28,6 +28,8 @@ import util
 import util
 import commands
 import libvirt
+import Guest
+from virtinst import _virtinst as _
 
 #
 # This class is the design paper for a clone virtual machine.
@@ -61,39 +63,41 @@ class CloneDesign(object):
 
         self._preserve           = True
 
+        # Throwaway guest to use for easy validation
+        self._valid_guest        = Guest.Guest()
+
     def get_original_guest(self):
         return self._original_guest
     def set_original_guest(self, original_guest):
         if len(original_guest) == 0:
-           raise ValueError, "Original name or uuid must be needed"
+           raise ValueError, _("Name or UUID of guest to clone is required")
+
+        try:
+            self._valid_guest.set_uuid(original_guest)
+        except ValueError, e:
+            try:
+                self._valid_guest.set_name(original_guest)
+            except ValueError, e:
+                raise ValueError, \
+                    _("A valid name or UUID of guest to clone is required")
         self._original_guest = original_guest
     original_guest = property(get_original_guest, set_original_guest)
 
     def get_clone_name(self):
         return self._clone_name
     def set_clone_name(self, name):
-        if len(name) == 0:
-           raise ValueError, "New name must be needed"
-        if re.match("^[0-9]+$", name):
-            raise ValueError, "Domain name must not be numeric only"
-        if re.match("^[a-zA-Z0-9_-]+$", name) == None:
-            raise ValueError, "Domain name must be alphanumeric or _ or -"
-        if len(name) > 50:
-            raise ValueError, "Domain name must be less than or equal to 50 characters"
-        if type(name) != type("string"):
-            raise ValueError, "Domain name must be a string"
+        try:
+            self._valid_guest.set_name(clone_name)
+        except ValueError, e:
+            raise ValueError, _("Invalid name for new guest: %s") % (str(e),)
         self._clone_name = name
     clone_name = property(get_clone_name, set_clone_name)
 
     def set_clone_uuid(self, uuid):
-        # need better validation
-        form = re.match("[a-fA-F0-9]{8}[-]([a-fA-F0-9]{4}[-]){3}[a-fA-F0-9]{12}$", uuid)
-        if form is None:
-            form=re.match("[a-fA-F0-9]{32}$", uuid)
-            if form is None:
-                raise ValueError, "UUID must be a 32-digit hexadecimal number. It may take the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or may omit hyphens altogether."
-            else:
-                uuid=uuid[0:8] + "-" + uuid[8:12] + "-" + uuid[12:16] + "-" + uuid[16:20] + "-" + uuid[20:32]
+        try:
+            self._valid_guest.set_uuid(uuid)
+        except ValueError, e:
+            raise ValueError, _("Invalid uuid for new guest: %s") % (str(e),)
         self._clone_uuid = uuid
     def get_clone_uuid(self):
         return self._clone_uuid
@@ -101,16 +105,14 @@ class CloneDesign(object):
 
     def set_clone_devices(self, devices):
         if len(devices) == 0:
-            raise ValueError, "New file to use disk image must be needed"
+            raise ValueError, _("New file to use for disk image is required")
         self._clone_devices.append(devices)
     def get_clone_devices(self):
         return self._clone_devices
     clone_devices = property(get_clone_devices)
 
     def set_clone_mac(self, mac):
-        form = re.match("^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$", str(mac))
-        if form is None:
-            raise ValueError, "Invalid value for MAC address"
+        Guest.VirtualNetworkInterface(mac)
         self._clone_mac.append(mac)
     def get_clone_mac(self):
         return self._clone_mac
@@ -174,7 +176,7 @@ class CloneDesign(object):
         try:
             self._original_dom = self._hyper_conn.lookupByName(self._original_guest)
         except libvirt.libvirtError, e:
-            raise RuntimeError,  "Domain %s is not found" % self._original_guest
+            raise RuntimeError, _("Domain %s is not found") % self._original_guest
 
         #
         # store the xml as same as original xml still setup_clone_xml
@@ -191,14 +193,14 @@ class CloneDesign(object):
         status = self._original_dom.info()[0]
         logging.debug("original guest status: %s" % (status))
         if status != libvirt.VIR_DOMAIN_SHUTOFF:
-            raise RuntimeError, "Domain status must be shutoff"
+            raise RuntimeError, _("Domain status must be SHUTOFF")
 
         #
         # check existing
         #
         try:
             if self._hyper_conn.lookupByName(self._clone_name) is not None:
-                raise RuntimeError, "Domain %s already exists" % self._clone_name
+                raise RuntimeError, _("Domain %s already exists") % self._clone_name
         except libvirt.libvirtError:
             pass
 
@@ -207,7 +209,7 @@ class CloneDesign(object):
         # random uuid check is done in start_duplicate function
         #
         if self._check_uuid(self._clone_uuid) == True:
-            raise RuntimeError, "The UUID you entered is already in use by another guest!"
+            raise RuntimeError, _("The UUID you entered is already in use by another guest!")
 
         #
         # check used mac
@@ -251,7 +253,7 @@ class CloneDesign(object):
             try:
                 node.setContent(clone_devices.next())
             except Exception, e:
-                raise ValueError, "Missing new file to use disk image for %s" % node.getContent()
+                raise ValueError, _("Missing new file to use disk image for %s") % node.getContent()
 
         # changing uuid
         node = ctx.xpathEval("/domain/uuid")
@@ -329,9 +331,9 @@ class CloneDesign(object):
     def _check_mac(self, mac):
 
         msg0=""
-        msg1="The MAC address you entered conflicts with the physical NIC."
-        msg2="The MAC address you entered is already in use by another guest!"
-        msg3="The MAC address you entered is already in use by another inactive guest!" 
+        msg1=_("The MAC address you entered conflicts with the physical NIC.")
+        msg2=_("The MAC address you entered is already in use by another guest!")
+        msg3=_("The MAC address you entered is already in use by another inactive guest!")
 
         # get Running Domains
         ids = self._hyper_conn.listDomainsID();
@@ -559,8 +561,9 @@ def _do_duplicate(design):
 
             size = dst_siz
             meter = progress.TextMeter()
-            print "Cloning from %s to %s" % (src_dev, dst_dev)
-            meter.start(size=size, text="Cloning domain...")
+            print _("Cloning from %(src)s to %(dst)s") % {'src' : src_dev, \
+                                                       'dst' : dst_dev}
+            meter.start(size=size, text=_("Cloning domain..."))
 
             # skip
             if src_dev == "/dev/null" or src_dev == dst_dev:
diff -r 77f6b840cf40 virtinst/DistroManager.py
--- a/virtinst/DistroManager.py	Wed Jul 04 10:39:57 2007 -0400
+++ b/virtinst/DistroManager.py	Fri Jul 06 15:16:49 2007 -0400
@@ -24,7 +24,7 @@ import urlgrabber.progress as progress
 import urlgrabber.progress as progress
 import tempfile
 import Guest
-
+from virtinst import _virtinst as _
 
 # This is a generic base class for fetching/extracting files from
 # a media source, such as CD ISO, NFS server, or HTTP/FTP server
@@ -66,12 +66,11 @@ class URIImageFetcher(ImageFetcher):
         try:
             grabber.urlopen(self.location,
                             progress_obj = progresscb,
-                            text = "Verifying install location...")
+                            text = _("Verifying install location..."))
             return True
         except IOError, e:
-            msg = "Opening URL " + self.location + " failed."
-            logging.debug(msg + " " + str(e))
-            raise ValueError(msg)
+            logging.debug("Opening URL %s failed." % (self.location,) + " " + str(e))
+            raise ValueError(_("Opening URL %s failed.") % (self.location,))
             return False
 
     def acquireFile(self, filename, progresscb):
@@ -82,9 +81,9 @@ class URIImageFetcher(ImageFetcher):
             try:
                 file = grabber.urlopen(self.location + "/" + filename,
                                        progress_obj = progresscb, \
-                                       text = "Retrieving %s..." % base)
+                                       text = _("Retrieving file %s...") % base)
             except IOError, e:
-                raise RuntimeError, "Invalid URL location given: " + str(e)
+                raise ValueError, _("Invalid URL location given: ") + str(e)
             tmpname = self.saveTemp(file, prefix=base + ".")
             logging.debug("Saved file to " + tmpname)
             return tmpname
@@ -119,9 +118,8 @@ class MountedImageFetcher(ImageFetcher):
         ret = subprocess.call(cmd)
         if ret != 0:
             self.cleanupLocation()
-            msg = "Mounting " + self.location + " failed."
-            logging.debug(msg)
-            raise ValueError(msg)
+            logging.debug("Mounting location %s failed" % (self.location,))
+            raise ValueError(_("Mounting location %s failed") % (self.location))
             return False
         return True
 
@@ -147,9 +145,9 @@ class MountedImageFetcher(ImageFetcher):
                 else:
                     file = open(src, "r")
             except IOError, e:
-                raise RuntimeError, "Invalid location given: " + str(e)
+                raise ValueError, _("Invalid file location given: ") + str(e)
             except OSError, (errno, msg):
-                raise RuntimeError, "Invalid location given: " + msg
+                raise ValueError, _("Invalid file location given: ") + msg
             tmpname = self.saveTemp(file, prefix=base + ".")
             logging.debug("Saved file to " + tmpname)
             return tmpname
@@ -315,9 +313,9 @@ class SuseImageStore(ImageStore):
                                 kernelrpm = dir + "/" + filename
 
             if kernelrpm is None:
-                raise "Unable to determine kernel RPM path"
+                raise _("Unable to determine kernel RPM path")
             if installinitrdrpm is None:
-                raise "Unable to determine install-initrd RPM path"
+                raise _("Unable to determine install-initrd RPM path")
             return (kernelrpm, installinitrdrpm)
         finally:
             filelistData.close()
@@ -328,7 +326,7 @@ class SuseImageStore(ImageStore):
     #
     # Yes, this is crazy ass stuff :-)
     def buildKernelInitrd(self, fetcher, kernelrpm, installinitrdrpm, progresscb):
-        progresscb.start(text="Building initrd", size=11)
+        progresscb.start(text=_("Building initrd"), size=11)
         progresscb.update(1)
         cpiodir = tempfile.mkdtemp(prefix="virtinstcpio.", dir=self.scratchdir)
         try:
@@ -563,7 +561,7 @@ def _storeForDistro(fetcher, baseuri, ty
         if store.isValidStore(fetcher, progresscb):
             return store
 
-    raise RuntimeError, "Could not find an installable distribution the install location"
+    raise ValueError, _("Could not find an installable distribution the install location")
 
 
 # Method to fetch a krenel & initrd pair for a particular distro / HV type
@@ -573,7 +571,7 @@ def acquireKernel(baseuri, progresscb, s
     try:
         fetcher.prepareLocation(progresscb)
     except ValueError, e:
-        raise RuntimeError, "Invalid install location: " + str(e)
+        raise ValueError, _("Invalid install location: ") + str(e)
 
     try:
         store = _storeForDistro(fetcher=fetcher, baseuri=baseuri, type=type, \
@@ -589,7 +587,7 @@ def acquireBootDisk(baseuri, progresscb,
     try:
         fetcher.prepareLocation(progresscb)
     except ValueError, e:
-        raise RuntimeError, "Invalid install location: " + str(e)
+        raise ValueError, _("Invalid install location: ") + str(e)
 
     try:
         store = _storeForDistro(fetcher=fetcher, baseuri=baseuri, type=type, \
@@ -607,10 +605,9 @@ class DistroInstaller(Guest.Installer):
     def set_location(self, val):
         if not (val.startswith("http://";) or val.startswith("ftp://";) or
                 val.startswith("nfs:") or val.startswith("/")):
-            raise ValueError("Install location must be an NFS, HTTP or FTP " +
-                             "network install source, or local file/device")
+            raise ValueError(_("Install location must be an NFS, HTTP or FTP network install source, or local file/device"))
         if os.geteuid() != 0 and val.startswith("nfs:"):
-            raise ValueError("NFS installations are only supported as root")
+            raise ValueError(_("NFS installations are only supported as root"))
         self._location = val
     location = property(get_location, set_location)
 
diff -r 77f6b840cf40 virtinst/FullVirtGuest.py
--- a/virtinst/FullVirtGuest.py	Wed Jul 04 10:39:57 2007 -0400
+++ b/virtinst/FullVirtGuest.py	Fri Jul 06 15:17:09 2007 -0400
@@ -19,6 +19,7 @@ import DistroManager
 import DistroManager
 import logging
 import time
+from virtinst import _virtinst as _
 
 
 class FullVirtGuest(Guest.XenGuest):
@@ -117,7 +118,7 @@ class FullVirtGuest(Guest.XenGuest):
         if FullVirtGuest.OS_TYPES.has_key(val):
             self._os_type = val
         else:
-            raise RuntimeError, "OS type %s does not exist in our dictionary" % val
+            raise ValueError, _("OS type %s does not exist in our dictionary") % val
     os_type = property(get_os_type, set_os_type)
 
     def get_os_variant(self):
@@ -126,7 +127,7 @@ class FullVirtGuest(Guest.XenGuest):
         if FullVirtGuest.OS_TYPES[self._os_type]["variants"].has_key(val):
             self._os_variant = val
         else:
-            raise RuntimeError, "OS variant %s does not exist in our dictionary for OS type %s" % (val, self._os_type)
+            raise ValueError, _("OS variant %(var)s does not exist in our dictionary for OS type %(type)s") % {'var' : val, 'type' : self._os_type}
     os_variant = property(get_os_variant, set_os_variant)
 
     def set_os_type_parameters(self, os_type, os_variant):
@@ -177,7 +178,7 @@ class FullVirtGuest(Guest.XenGuest):
 
     def validate_parms(self):
         if not self.location:
-            raise RuntimeError, "A CD must be specified to boot from"
+            raise ValueError, _("A CD must be specified to boot from")
         self.set_os_type_parameters(self.os_type, self.os_variant)
         Guest.Guest.validate_parms(self)
 
@@ -208,7 +209,7 @@ class FullVirtGuest(Guest.XenGuest):
         meter.start(size=None, text="Starting domain...")
         self.domain = self.conn.createLinux(install_xml, 0)
         if self.domain is None:
-            raise RuntimeError, "Unable to start domain for guest, aborting installation!"
+            raise RuntimeError, _("Unable to start domain for guest, aborting installation!")
         meter.end(0)
 
         self.connect_console(consolecb)
@@ -235,7 +236,7 @@ class FullVirtGuest(Guest.XenGuest):
                 else:
                     continue
             if count > 4:
-                raise ValueError, "Can't use more than 4 disks on an HVM guest"
+                raise ValueError, _("Can't use more than 4 disks on an HVM guest")
             if d.device == Guest.VirtualDisk.DEVICE_CDROM and count != 2:
                 disknode = "%(disknode)s%(dev)c" % { "disknode": self.disknode, "dev": ord('a') + 2 }
             else:
diff -r 77f6b840cf40 virtinst/Guest.py
--- a/virtinst/Guest.py	Wed Jul 04 10:39:57 2007 -0400
+++ b/virtinst/Guest.py	Fri Jul 06 15:14:20 2007 -0400
@@ -17,12 +17,17 @@ import re
 import re
 import libxml2
 import urlgrabber.progress as progress
-
+import util
 import libvirt
-
-import util
+from virtinst import _virtinst as _
 
 import logging
+
+
+#print "YO %s" % (virtinst.gettext_virtinst("YO"))
+
+#def _(msg):
+#    gettext_virtinst(msg)
 
 class VirtualDisk:
     DRIVER_FILE = "file"
@@ -50,11 +55,11 @@ class VirtualDisk:
 
         if os.path.isdir(self.path):
             raise ValueError, \
-                "The disk path must be a file/device, not a directory"
+                _("The disk path must be a file or a device, not a directory")
 
         if not self.path.startswith("/"):
             raise ValueError, \
-                "The disk path must be an absolute path location, beginning with '/'"
+                _("The disk path must be an absolute path location, beginning with '/'")
 
         if type is None:
             if not os.path.exists(self.path):
@@ -73,15 +78,15 @@ class VirtualDisk:
         if self._type == VirtualDisk.TYPE_FILE:
             if size is None and not os.path.exists(self.path):
                 raise ValueError, \
-                    "A size must be provided for non-existent disks"
+                    _("A size must be provided for non-existent disks")
             if size is not None and size <= 0:
                 raise ValueError, \
-                    "The size of the disk image must be greater than 0"
+                    _("The size of the disk image must be greater than 0")
         elif self._type == VirtualDisk.TYPE_BLOCK:
             if not os.path.exists(self.path):
-                raise ValueError, "The specified block device does not exist." 
+                raise ValueError, _("The specified block device does not exist.")
             if not stat.S_ISBLK(os.stat(self.path)[stat.ST_MODE]):
-                raise ValueError, "The specified path is not a block device."
+                raise ValueError, _("The specified path is not a block device.")
 
         self._readOnly = readOnly
         self._device = device
@@ -116,7 +121,7 @@ class VirtualDisk:
         if self._type == VirtualDisk.TYPE_FILE and not os.path.exists(self.path):
             size_bytes = long(self.size * 1024L * 1024L * 1024L)
             progresscb.start(filename=self.path,size=long(size_bytes), \
-                             text="Creating storage file...")
+                             text=_("Creating storage file..."))
             fd = None
             try: 
                 fd = os.open(self.path, os.O_WRONLY | os.O_CREAT)
@@ -206,26 +211,26 @@ class VirtualNetworkInterface:
         if macaddr is not None:
             form = re.match("^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$",macaddr)
             if form is None:
-                raise ValueError("MAC address must be of the format AA:BB:CC:DD:EE:FF")
+                raise ValueError(_("MAC address must be of the format AA:BB:CC:DD:EE:FF"))
         self.macaddr = macaddr
         self.type = type
         self.bridge = bridge
         self.network = network
         if self.type == "network":
             if network is None:
-                raise ValueError, "No network name provided"
+                raise ValueError, _("A network name was not provided")
             if bridge != None:
-                raise ValueError, "Bridge name is not required for type=network"
+                raise ValueError, _("Bridge name is not required for %s") % ("type=network",)
         elif self.type == "bridge":
             if network != None:
-                raise ValueError, "Network name is not required for type=bridge"
+                raise ValueError, _("Network name is not required for %s") % ("type=bridge",)
         elif self.type == "user":
             if network != None:
-                raise ValueError, "Network name is not required for type=bridge"
+                raise ValueError, _("Network name is not required for %s") % ("type=bridge",)
             if bridge != None:
-                raise ValueError, "Bridge name is not required for type=network"
-        else:
-            raise ValueError, "Unknown network type %s" % (type)
+                raise ValueError, _("Bridge name is not required for %s") % ("type=network",)
+        else:
+            raise ValueError, _("Unknown network type %s") % (type,)
 
     def setup(self, conn):
         # get Running Domains
@@ -254,12 +259,12 @@ class VirtualNetworkInterface:
                     break
         else:
             if self.countMACaddr(vms) > 0:
-                raise RuntimeError, "The MAC address you entered is already in use by another guest!"
+                raise RuntimeError, _("The MAC address you entered is already in use by another virtual machine!")
             for (dummy, dummy, dummy, dummy, host_macaddr) in hostdevs:
                 if self.macaddr.upper() == host_macaddr.upper():
-                    raise RuntimeError, "The MAC address you entered conflicts with the physical NIC."
+                    raise RuntimeError, _("The MAC address you entered conflicts with the physical NIC.")
             if self.countMACaddr(inactive_vm) > 0:
-                msg = "The MAC address you entered is already in use by another inactive guest!"
+                msg = _("The MAC address you entered is already in use by another inactive virtual machine!")
                 print >> sys.stderr, msg
                 logging.warning(msg)
 
@@ -329,7 +334,7 @@ class VNCVirtualGraphics(XenGraphics):
         self.name = "vnc"
         if len(args) >= 1 and not args[0] is None:
             if args[0] < 5900:
-                raise ValueError, "Invalid value for vncport, port number must be greater than or equal to 5900"
+                raise ValueError, _("Invalid value for vnc port, port number must be greater than or equal to 5900")
             self.port = args[0]
         else:
             self.port = -1
@@ -409,16 +414,16 @@ class Installer(object):
     def set_boot(self, val):
         if type(val) == tuple:
             if len(val) != 2:
-                raise ValueError, "Must pass both a kernel and initrd"
+                raise ValueError, _("Must pass both a kernel and initrd")
             (k, i) = val
             self._boot = {"kernel": k, "initrd": i}
         elif type(val) == dict:
             if not val.has_key("kernel") or not val.has_key("initrd"):
-                raise ValueError, "Must pass both a kernel and initrd"
+                raise ValueError, _("Must pass both a kernel and initrd")
             self._boot = val
         elif type(val) == list:
             if len(val) != 2:
-                raise ValueError, "Must pass both a kernel and initrd"
+                raise ValueError, _("Must pass both a kernel and initrd")
             self._boot = {"kernel": val[0], "initrd": val[1]}
     boot = property(get_boot, set_boot)
 
@@ -447,7 +452,7 @@ class Guest(object):
         if self.conn == None:
             self.conn = libvirt.open(hypervisorURI)
         if self.conn == None:
-            raise RuntimeError, "Unable to connect to hypervisor, aborting installation!"
+            raise RuntimeError, _("Unable to connect to hypervisor, aborting installation!")
 
         self.disknode = None # this needs to be set in the subclass
 
@@ -468,13 +473,13 @@ class Guest(object):
         return self._name
     def set_name(self, val):
         if len(val) > 50 or len(val) == 0:
-            raise ValueError, "System name must be greater than 0 and no more than 50 characters"
+            raise ValueError, _("System name must be greater than 0 and no more than 50 characters")
         if re.match("^[0-9]+$", val):
-            raise ValueError, "System name must not be only numeric characters"
+            raise ValueError, _("System name must not be only numeric characters")
         if re.match("^[a-zA-Z0-9._-]+$", val) == None:
-            raise ValueError, "System name can only contain alphanumeric, '_', '.', or '-' characters"
+            raise ValueError, _("System name can only contain alphanumeric, '_', '.', or '-' characters")
         if type(val) != type("string"):
-            raise ValueError, "System name must be a string"
+            raise ValueError, _("System name must be a string")
         self._name = val
     name = property(get_name, set_name)
 
@@ -484,7 +489,7 @@ class Guest(object):
         return self._memory
     def set_memory(self, val):
         if (type(val) is not type(1) or val < 0):
-            raise ValueError, "Memory value must be an integer greater than 0"
+            raise ValueError, _("Memory value must be an integer greater than 0")
         self._memory = val
         if self._maxmemory is None or self._maxmemory < val:
             self._maxmemory = val
@@ -495,7 +500,7 @@ class Guest(object):
         return self._maxmemory
     def set_maxmemory(self, val):
         if (type(val) is not type(1) or val < 0):
-            raise ValueError, "Max Memory value must be an integer greater than 0"
+            raise ValueError, _("Max Memory value must be an integer greater than 0")
         self._maxmemory = val
     maxmemory = property(get_maxmemory, set_maxmemory)
 
@@ -509,9 +514,7 @@ class Guest(object):
         if form is None:
             form = re.match("[a-fA-F0-9]{32}$", val)
             if form is None:
-                raise ValueError, "UUID must be a 32-digit hexadecimal " + \
-                      "number. It may take the form XXXXXXXX-XXXX-XXXX-" + \
-                      "XXXX-XXXXXXXXXXXX or may omit hyphens altogether."
+                raise ValueError, _("UUID must be a 32-digit hexadecimal number. It may take the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or may omit hyphens altogether.")
 
             else:   # UUID had no dashes, so add them in
                 val=val[0:8] + "-" + val[8:12] + "-" + val[12:16] + \
@@ -527,7 +530,7 @@ class Guest(object):
         maxvcpus = util.get_max_vcpus(self.conn)
         if val < 1 or val > maxvcpus:
             raise ValueError, \
-                  "Number of vcpus must be in the range of 1-%d" % (maxvcpus,)
+                  _("Number of vcpus must be in the range of 1-%d") % (maxvcpus,)
         self._vcpus = val
     vcpus = property(get_vcpus, set_vcpus)
 
@@ -540,18 +543,18 @@ class Guest(object):
             if not keymap:
                 return keymap
             if type(keymap) != type("string"):
-                raise ValueError, "Keymap must be a string"
+                raise ValueError, _("Keymap must be a string")
             if len(keymap) > 16:
-                raise ValueError, "Keymap must be less than 16 characters"
+                raise ValueError, _("Keymap must be less than 16 characters")
             if re.match("^[a-zA-Z0-9_-]*$", keymap) == None:
-                raise ValueError, "Keymap must be alphanumeric, _, or -"
+                raise ValueError, _("Keymap can only contain alphanumeric, '_', or '-' characters")
             return keymap
 
         opts = None
         t = None
         if type(val) == dict:
             if not val.has_key("enabled"):
-                raise ValueError, "Must specify whether graphics are enabled"
+                raise ValueError, _("Must specify whether graphics are enabled")
             self._graphics["enabled"] = val["enabled"]
             if val.has_key("type"):
                 t = val["type"]
@@ -570,7 +573,7 @@ class Guest(object):
                 self._graphics["enabled"] = val
 
         if self._graphics["enabled"] not in (True, False):
-            raise ValueError, "Graphics enabled must be True or False"
+            raise ValueError, _("Graphics enabled must be True or False")
 
         if self._graphics["enabled"] == True:
             if t == "vnc":
@@ -581,7 +584,7 @@ class Guest(object):
             elif t == "sdl":
                 gt = SDLVirtualGraphics(opts)
             else:
-                raise ValueError, "Unknown graphics type"
+                raise ValueError, _("Unknown graphics type")
             self._graphics["type"] = gt
 
     graphics = property(get_graphics, set_graphics)
@@ -617,9 +620,9 @@ class Guest(object):
         return None
     def set_cdrom(self, val):
         if val is None or len(val) == 0:
-            raise ValueError, "You must specify an ISO or CD-ROM location for the guest installation"
+            raise ValueError, _("You must specify an ISO or CD-ROM location for the installation")
         if not os.path.exists(val):
-            raise ValueError, "The specified media path does not exist."
+            raise ValueError, _("The specified media path does not exist.")
         self._installer.location = os.path.abspath(val)
     cdrom = property(get_cdrom, set_cdrom)
 
@@ -709,7 +712,7 @@ class Guest(object):
     def _do_install(self, consolecb, meter):
         try:
             if self.conn.lookupByName(self.name) is not None:
-                raise RuntimeError, "Domain named %s already exists!" %(self.name,)
+                raise RuntimeError, _("Domain named %s already exists!") %(self.name,)
         except libvirt.libvirtError:
             pass
 
@@ -718,10 +721,10 @@ class Guest(object):
         install_xml = self.get_config_xml()
         if install_xml:
             logging.debug("Creating guest from '%s'" % ( install_xml ))
-            meter.start(size=None, text="Creating domain...")
+            meter.start(size=None, text=_("Creating domain..."))
             self.domain = self.conn.createLinux(install_xml, 0)
             if self.domain is None:
-                raise RuntimeError, "Unable to create domain for guest, aborting installation!"
+                raise RuntimeError, _("Unable to create domain for the guest, aborting installation!")
             meter.end(0)
 
             logging.debug("Created guest, looking to see if it is running")
@@ -741,7 +744,7 @@ class Guest(object):
                 time.sleep(0.25)
 
             if d is None:
-                raise RuntimeError, "It appears that your installation has crashed.  You should be able to find more information in the logs"
+                raise RuntimeError, _("It appears that your installation has crashed.  You should be able to find more information in the logs")
 
             if consolecb:
                 logging.debug("Launching console callback")
@@ -787,9 +790,9 @@ class Guest(object):
             time.sleep(0.25)
 
         if self.domain is None:
-            raise RuntimeError, "Domain has not existed.  You should be able to find more information in the logs"
+            raise RuntimeError, _("Domain has not existed.  You should be able to find more information in the logs")
         elif self.domain.ID() == -1:
-            raise RuntimeError, "Domain has not run yet.  You should be able to find more information in the logs"
+            raise RuntimeError, _("Domain has not run yet.  You should be able to find more information in the logs")
 
         child = None
         if consolecb:
@@ -804,7 +807,7 @@ class Guest(object):
 
     def validate_parms(self):
         if self.domain is not None:
-            raise RuntimeError, "Domain already started!"
+            raise RuntimeError, _("Domain has already been started!")
         self._set_defaults()
 
     def _set_defaults(self):
@@ -815,15 +818,16 @@ class Guest(object):
                     if self.conn.lookupByUUIDString(self.uuid) is not None:
                         continue
                     else:
-                        # libvirt probably shouldn't throw an error on a non-matching UUID,
-                        # so do the right thing on a None return value with no error
+                        # libvirt probably shouldn't throw an error on a 
+                        # non-matching UUID, so do the right thing on a 
+                        # None return value with no error
                         break
                 except libvirt.libvirtError:
                     break
         else:
             try:
                 if self.conn.lookupByUUIDString(self.uuid) is not None:
-                    raise RuntimeError, "The UUID you entered is already in use by another guest!"
+                    raise RuntimeError, _("The UUID you entered is already in use by another guest!")
                 else:
                     pass
             except libvirt.libvirtError:
@@ -831,7 +835,7 @@ class Guest(object):
         if self.vcpus is None:
             self.vcpus = 1
         if self.name is None or self.memory is None:
-            raise RuntimeError, "Name and memory must be specified for all guests!"
+            raise RuntimeError, _("Name and memory must be specified for all guests!")
 
 # Back compat class to avoid ABI break
 class XenGuest(Guest):
diff -r 77f6b840cf40 virtinst/LiveCDInstaller.py
--- a/virtinst/LiveCDInstaller.py	Wed Jul 04 10:39:57 2007 -0400
+++ b/virtinst/LiveCDInstaller.py	Fri Jul 06 15:17:18 2007 -0400
@@ -16,6 +16,7 @@ import os
 
 import Guest
 import CapabilitiesParser
+from virtinst import _virtinst as _
 
 class LiveCDInstallerException(Exception):
     def __init__(self, msg):
@@ -29,7 +30,7 @@ class LiveCDInstaller(Guest.Installer):
         self.cleanup()
 
         if not os.path.exists(self.location):
-            raise LiveCDInstallerException("LiveCD image '%s' does not exist" % self.location)
+            raise LiveCDInstallerException(_("LiveCD image '%s' does not exist") % self.location)
 
         capabilities = CapabilitiesParser.parse(guest.conn.getCapabilities())
 
@@ -40,7 +41,7 @@ class LiveCDInstaller(Guest.Installer):
                 break
 
         if not found:
-            raise LiveCDInstallerException("HVM virtualisation not supported; cannot boot LiveCD")
+            raise LiveCDInstallerException(_("HVM virtualisation not supported; cannot boot LiveCD"))
 
         disk = Guest.VirtualDisk(self.location,
                                  device = Guest.VirtualDisk.DEVICE_CDROM,
diff -r 77f6b840cf40 virtinst/ParaVirtGuest.py
--- a/virtinst/ParaVirtGuest.py	Wed Jul 04 10:39:57 2007 -0400
+++ b/virtinst/ParaVirtGuest.py	Fri Jul 06 15:18:21 2007 -0400
@@ -16,6 +16,7 @@ import libvirt
 import libvirt
 import Guest
 import DistroManager
+from virtinst import _virtinst as _
 
 class ParaVirtGuest(Guest.XenGuest):
     def __init__(self, type=None, connection=None, hypervisorURI=None, installer=None):
@@ -37,7 +38,7 @@ class ParaVirtGuest(Guest.XenGuest):
 
     def validate_parms(self):
         if not self.location and not self.boot:
-            raise RuntimeError, "A location must be specified to install from"
+            raise ValueError, _("A location must be specified to install from")
         Guest.Guest.validate_parms(self)
 
     def _prepare_install(self, meter):
@@ -51,7 +52,7 @@ class ParaVirtGuest(Guest.XenGuest):
             if d.transient and not install:
                 continue
             if count > 15:
-                raise ValueError, "Can't use more than 16 disks on a PV guest"
+                raise ValueError, _("Can't use more than 16 disks on a PV guest")
             ret += d.get_xml_config("%(disknode)s%(dev)c" % { "disknode": self.disknode, "dev": ord('a') + count })
             count += 1
         return ret
diff -r 77f6b840cf40 virtinst/util.py
--- a/virtinst/util.py	Wed Jul 04 10:39:57 2007 -0400
+++ b/virtinst/util.py	Fri Jul 06 15:18:35 2007 -0400
@@ -15,6 +15,7 @@ import random
 import random
 import os.path
 from sys import stderr
+from virtinst import _virtinst as _
 
 def default_route():
     route_file = "/proc/net/route"
@@ -24,8 +25,8 @@ def default_route():
     for line in d.xreadlines():
         info = line.split()
         if (len(info) != 11): # 11 = typlical num of fields in the file
-            print >> stderr, "Invalid line lenght while parsing %s."%(route_file)
-            print >> stderr, " Defaulting bridge to xenbr%d"%(defn)
+            print >> stderr, _("Invalid line length while parsing %s.") %(route_file)
+            print >> stderr, _("Defaulting bridge to xenbr%d") % (defn)
             break
         try:
             route = int(info[1],16)
@@ -182,7 +183,7 @@ def get_max_vcpus(conn):
     """@conn libvirt connection to poll for max possible vcpus"""
     try:
         max = conn.getMaxVcpus(conn.getType())
-    except:
-        print >> stderr, "Couldn't determine max vcpus. Using 32."
+    except Exception, e:
+        print >> stderr, _("Couldn't determine max vcpus. Using 32.")
         max = 32
     return max
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux