Re: [libvirt] [PATCH 06/16] Wrap all output strings with _() to make sure we get proper translations.

2013-04-03 Thread Daniel P. Berrange
On Tue, Apr 02, 2013 at 06:11:22PM -0400, Dan Walsh wrote:
 Signed-off-by: Dan Walsh dwa...@redhat.com
 ---
  bin/virt-sandbox-service | 48 
 
  1 file changed, 24 insertions(+), 24 deletions(-)

Well, we haven't enabled localization at all in libvirt-sandbox, but
this doesn't hurt, so ACK

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 06/16] Wrap all output strings with _() to make sure we get proper translations.

2013-04-02 Thread Dan Walsh
Signed-off-by: Dan Walsh dwa...@redhat.com
---
 bin/virt-sandbox-service | 48 
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 0e38577..a064e9a 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -91,7 +91,7 @@ class Container:
 
 if create:
 if config and os.path.exists(config):
-raise ValueError([Container already exists])
+raise ValueError([_(Container already exists)])
 
 self.config = LibvirtSandbox.ConfigService.new(name)
 return
@@ -123,7 +123,7 @@ class Container:
 
 def __get_sandbox_target(self):
 if len(self.unit_file_list)  1:
-raise ValueError([Only Valid for single units])
+raise ValueError([_(Only Valid for single units)])
 return %s_sandbox.target %  self.__get_sandboxed_service()
 
 def __target(self):
@@ -178,8 +178,8 @@ WantedBy=%(TARGET)s
 p = Popen([/usr/bin/systemctl,enable, self.unitfile],stdout=PIPE, 
stderr=PIPE)
 p.communicate()
 if p.returncode and p.returncode != 0:
-raise OSError(Failed to enable %s unit file  %  self.unitfile)
-sys.stdout.write(Created unit file %s\n %  self.unitfile)
+raise OSError(_(Failed to enable %s unit file) %  self.unitfile)
+sys.stdout.write(_(Created unit file %s\n) %  self.unitfile)
 
 def __add_dir(self, newd):
 if newd in self.all_dirs:
@@ -229,7 +229,7 @@ WantedBy=%(TARGET)s
 def get_name(self):
 if self.config:
 return self.config.get_name()
-raise ValueError([Name not configured])
+raise ValueError([_(Name not configured)])
 
 def set_copy(self, copy):
 self.copy = copy
@@ -255,10 +255,10 @@ WantedBy=%(TARGET)s
 
 selabel = self.get_security_label()
 if selabel is None:
-raise ValueError([Missing security label configuration])
+raise ValueError([_(Missing security label configuration)])
 parts = selabel.split(:)
 if len(parts) != 5 and len(parts) != 4:
-raise ValueError([Expected 5 parts in SELinux security label %s 
% parts])
+raise ValueError([_(Expected 5 parts in SELinux security label 
%s) % parts])
 
 if len(parts) == 5:
 selinux.chcon(self.dest, system_u:object_r:%s:%s:%s % (
@@ -276,7 +276,7 @@ WantedBy=%(TARGET)s
 
 def set_name(self, name):
 if self.config:
-raise ValueError([Cannot modify Name])
+raise ValueError([_(Cannot modify Name)])
 self.dest = %s/%s % (self.path, self.name)
 self.config = LibvirtSandbox.ConfigService.new(name)
 
@@ -317,7 +317,7 @@ WantedBy=%(TARGET)s
 try:
 h = mi.next();
 except exceptions.StopIteration:
-raise ValueError([Cannot find package containing %s % unitfile])
+raise ValueError([_(Cannot find package containing %s) % 
unitfile])
 
 for fentry in h.fiFromHeader():
 fname = fentry[0]
@@ -337,7 +337,7 @@ WantedBy=%(TARGET)s
 try:
 h = mi.next();
 except exceptions.StopIteration:
-raise ValueError([Cannot find base package %s % srcrpmbits[0]])
+raise ValueError([_(Cannot find base package %s) % 
srcrpmbits[0]])
 
 for fentry in h.fiFromHeader():
 fname = fentry[0]
@@ -528,7 +528,7 @@ PrivateNetwork=false
 p = Popen([/bin/umount, self.dest])
 p.communicate()
 if p.returncode and p.returncode != 0:
-raise OSError(Failed to unmount image %s from %s  %  
(self.image, self.dest))
+raise OSError(_(Failed to unmount image %s from %s) %  
(self.image, self.dest))
 
 def __create_image(self):
 fd = open(self.image, w)
@@ -537,12 +537,12 @@ PrivateNetwork=false
 p = Popen([/sbin/mkfs,-F, -t, ext4, self.image],stdout=PIPE, 
stderr=PIPE)
 p.communicate()
 if p.returncode and p.returncode != 0:
-raise OSError(Failed to build image %s % self.image )
+raise OSError(_(Failed to build image %s) % self.image )
 
 p = Popen([/bin/mount, self.image, self.dest])
 p.communicate()
 if p.returncode and p.returncode != 0:
-raise OSError(Failed to mount image %s on %s  %  (self.image, 
self.dest))
+raise OSError(_(Failed to mount image %s on %s) %  (self.image, 
self.dest))
 
 def save_config(self):
 config = self.get_config_path()
@@ -551,7 +551,7 @@ PrivateNetwork=false
 self.config.save_to_path(config)
 if selinux is not None:
 selinux.restorecon(config)
-sys.stdout.write(Created sandbox config %s\n % config)
+sys.stdout.write(_(Created sandbox config %s\n) % config)
 
 def __get_image_path(self):
 mounts =