[Kimchi-devel] [PATCH] [Kimchi 1/2] Add translation to user log messages

Lucio Correia luciojhc at linux.vnet.ibm.com
Fri May 13 18:08:28 UTC 2016


Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
---
 control/networks.py       | 10 +++++-----
 control/storagepools.py   | 10 +++++-----
 control/storagevolumes.py | 14 ++++++--------
 control/templates.py      |  8 ++++----
 control/vm/hostdevs.py    |  4 ++--
 control/vm/ifaces.py      |  6 +++---
 control/vm/snapshots.py   |  6 +++---
 control/vm/storages.py    |  6 +++---
 control/vms.py            | 26 +++++++++++++-------------
 i18n.py                   | 45 +++++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 89 insertions(+), 46 deletions(-)

diff --git a/control/networks.py b/control/networks.py
index c87b5a6..4b18638 100644
--- a/control/networks.py
+++ b/control/networks.py
@@ -22,15 +22,15 @@ from wok.control.utils import UrlSubNode
 
 
 NETWORKS_REQUESTS = {
-    'POST': {'default': "Create %(connection)s virtual network '%(name)s'"},
+    'POST': {'default': "KCHNET0001L"},
 }
 
 NETWORK_REQUESTS = {
-    'DELETE': {'default': "Remove virtual network '%(ident)s'"},
-    'PUT': {'default': "Update virtual network '%(ident)s'"},
+    'DELETE': {'default': "KCHNET0002L"},
+    'PUT': {'default': "KCHNET0003L"},
     'POST': {
-        'activate': "Activate virtual network '%(ident)s'",
-        'deactivate': "Deactivate virtual network '%(ident)s'",
+        'activate': "KCHNET0004L",
+        'deactivate': "KCHNET0005L",
     },
 }
 
diff --git a/control/storagepools.py b/control/storagepools.py
index 714f4bb..2f25746 100644
--- a/control/storagepools.py
+++ b/control/storagepools.py
@@ -30,15 +30,15 @@ from wok.plugins.kimchi.model.storagepools import ISO_POOL_NAME
 
 
 STORAGEPOOLS_REQUESTS = {
-    'POST': {'default': "Create %(type)s storage pool '%(name)s'"},
+    'POST': {'default': "KCHPOOL0001L"},
 }
 
 STORAGEPOOL_REQUESTS = {
-    'DELETE': {'default': "Remove storage pool '%(ident)s'"},
-    'PUT': {'default': "Update storage pool '%(ident)s'"},
+    'DELETE': {'default': "KCHPOOL0002L"},
+    'PUT': {'default': "KCHPOOL0003L"},
     'POST': {
-        'activate': "Activate storage pool '%(ident)s'",
-        'deactivate': "Deactivate storage pool '%(ident)s'",
+        'activate': "KCHPOOL0004L",
+        'deactivate': "KCHPOOL0005L",
     },
 }
 
diff --git a/control/storagevolumes.py b/control/storagevolumes.py
index a04ad35..351e4bd 100644
--- a/control/storagevolumes.py
+++ b/control/storagevolumes.py
@@ -23,18 +23,16 @@ from wok.control.utils import get_class_name, model_fn
 
 
 STORAGEVOLUMES_REQUESTS = {
-    'POST': {'default': "Create storage volume '%(name)s' at pool '%(pool)s'"},
+    'POST': {'default': "KCHVOL0001L"},
 }
 
 STORAGEVOLUME_REQUESTS = {
-    'DELETE': {'default': "Remove storage volume '%(ident)s' from "
-                          "pool '%(pool)s'"},
-    'PUT': {'default': "Update storage volume '%(ident)s' at pool '%(pool)s'"},
+    'DELETE': {'default': "KCHVOL0002L"},
+    'PUT': {'default': "KCHVOL0003L"},
     'POST': {
-        'wipe': "Wipe storage volume '%(ident)s' off pool '%(pool)s'",
-        'resize': "Resize storage volume '%(ident)s' at pool '%(pool)s' with "
-                  "size %(size)s",
-        'clone': "Clone storage volume '%(ident)s' at pool '%(pool)s'",
+        'wipe': "KCHVOL0004L",
+        'resize': "KCHVOL0005L",
+        'clone': "KCHVOL0006L",
     },
 }
 
diff --git a/control/templates.py b/control/templates.py
index 343ced1..82697d0 100644
--- a/control/templates.py
+++ b/control/templates.py
@@ -22,14 +22,14 @@ from wok.control.utils import UrlSubNode
 
 
 TEMPLATES_REQUESTS = {
-    'POST': {'default': "Create template '%(name)s'"},
+    'POST': {'default': "KCHTMPL0001L"},
 }
 
 TEMPLATE_REQUESTS = {
-    'DELETE': {'default': "Remove template '%(ident)s'"},
-    'PUT': {'default': "Update template '%(ident)s'"},
+    'DELETE': {'default': "KCHTMPL0002L"},
+    'PUT': {'default': "KCHTMPL0003L"},
     'POST': {
-        'clone': "Clone template '%(ident)s'",
+        'clone': "KCHTMPL0004L",
     },
 }
 
diff --git a/control/vm/hostdevs.py b/control/vm/hostdevs.py
index e9fd5dc..d21e19d 100644
--- a/control/vm/hostdevs.py
+++ b/control/vm/hostdevs.py
@@ -22,12 +22,12 @@ from wok.control.utils import UrlSubNode
 
 
 VMHOSTDEVS_REQUESTS = {
-    'POST': {'default': "Attach host device '%(name)s' to guest '%(vmid)s'"},
+    'POST': {'default': "KCHVMHDEV0001L"},
 }
 
 VMHOSTDEV_REQUESTS = {
     'DELETE': {
-        'default': "Detach host device '%(ident)s' from guest '%(vmid)s'",
+        'default': "KCHVMHDEV0002L",
     },
 }
 
diff --git a/control/vm/ifaces.py b/control/vm/ifaces.py
index 9ecfc8f..0cea8b5 100644
--- a/control/vm/ifaces.py
+++ b/control/vm/ifaces.py
@@ -23,16 +23,16 @@ from wok.control.utils import UrlSubNode
 
 VMIFACES_REQUESTS = {
     'POST': {
-        'default': "Attach network interface '%(network)s' to guest '%(vm)s'",
+        'default': "KCHVMIF0001L",
     },
 }
 
 VMIFACE_REQUESTS = {
     'DELETE': {
-        'default': "Detach network interface '%(ident)s' from guest '%(vm)s'",
+        'default': "KCHVMIF0002L",
     },
     'PUT': {
-        'default': "Update network interface '%(ident)s' at guest '%(vm)s'",
+        'default': "KCHVMIF0003L",
     },
 }
 
diff --git a/control/vm/snapshots.py b/control/vm/snapshots.py
index d8cccc1..20f07a7 100644
--- a/control/vm/snapshots.py
+++ b/control/vm/snapshots.py
@@ -22,13 +22,13 @@ from wok.control.utils import UrlSubNode
 
 
 VMSNAPSHOTS_REQUESTS = {
-    'POST': {'default': "Create snapshot '%(name)s' at guest '%(vm)s'"},
+    'POST': {'default': "KCHSNAP0001L"},
 }
 
 VMSNAPSHOT_REQUESTS = {
-    'DELETE': {'default': "Remove snapshot '%(ident)s' from guest '%(vm)s'"},
+    'DELETE': {'default': "KCHSNAP0002L"},
     'POST': {
-        'revert': "Revert guest '%(vm)s' to snapshot '%(ident)s'",
+        'revert': "KCHSNAP0003L",
     },
 }
 
diff --git a/control/vm/storages.py b/control/vm/storages.py
index 4a4c8d2..615074a 100644
--- a/control/vm/storages.py
+++ b/control/vm/storages.py
@@ -23,13 +23,13 @@ from wok.control.utils import UrlSubNode
 
 VMSTORAGES_REQUESTS = {
     'POST': {
-        'default': "Attach %(type)s storage '%(path)s' to guest '%(vm)s'",
+        'default': "KCHVMSTOR0001L",
     },
 }
 
 VMSTORAGE_REQUESTS = {
-    'DELETE': {'default': "Remove storage '%(ident)s' from guest '%(vm)s'"},
-    'PUT': {'default': "Update storage '%(ident)s' at guest '%(vm)s'"},
+    'DELETE': {'default': "KCHVMSTOR0002L"},
+    'PUT': {'default': "KCHVMSTOR0003L"},
 }
 
 
diff --git a/control/vms.py b/control/vms.py
index 64df00e..2339017 100644
--- a/control/vms.py
+++ b/control/vms.py
@@ -25,24 +25,24 @@ from wok.plugins.kimchi.control.vm import sub_nodes
 
 VMS_REQUESTS = {
     'POST': {
-        'default': "Create guest '%(name)s' from template '%(template)s'",
+        'default': "KCHVM0001L",
     },
 }
 
 VM_REQUESTS = {
-    'DELETE': {'default': "Remove guest '%(ident)s'"},
-    'PUT': {'default': "Edit guest '%(ident)s'"},
+    'DELETE': {'default': "KCHVM0002L"},
+    'PUT': {'default': "KCHVM0003L"},
     'POST': {
-        'start': "Start guest '%(ident)s'",
-        'poweroff': "Power off guest '%(ident)s'",
-        'shutdown': "Shutdown guest '%(ident)s'",
-        'reset': "Restart guest '%(ident)s'",
-        'connect': "Connect to guest '%(ident)s' through novnc/spice",
-        'clone': "Clone guest '%(ident)s'",
-        'migrate': "Migrate guest '%(ident)s' to '%(remote_host)s'",
-        'suspend': "Suspend guest '%(ident)s'",
-        'resume': "Resume guest '%(ident)s'",
-        'serial': "Connect to guest '%(ident)s' through serial",
+        'start': "KCHVM0004L",
+        'poweroff': "KCHVM0005L",
+        'shutdown': "KCHVM0006L",
+        'reset': "KCHVM0007L",
+        'connect': "KCHVM0008L",
+        'clone': "KCHVM0009L",
+        'migrate': "KCHVM0010L",
+        'suspend': "KCHVM0011L",
+        'resume': "KCHVM0012L",
+        'serial': "KCHVM0013L",
     },
 }
 
diff --git a/i18n.py b/i18n.py
index db245c0..7baa3b6 100644
--- a/i18n.py
+++ b/i18n.py
@@ -331,4 +331,49 @@ messages = {
 
     "KCHLVMS0001E": _("Invalid volume group name parameter: %(name)s."),
 
+    # These messages (ending with L) are for user log purposes
+    "KCHNET0001L": _("Create %(connection)s virtual network '%(name)s'"),
+    "KCHNET0002L": _("Remove virtual network '%(ident)s'"),
+    "KCHNET0003L": _("Update virtual network '%(ident)s'"),
+    "KCHNET0004L": _("Activate virtual network '%(ident)s'"),
+    "KCHNET0005L": _("Deactivate virtual network '%(ident)s'"),
+    "KCHPOOL0001L": _("Create %(type)s storage pool '%(name)s'"),
+    "KCHPOOL0002L": _("Remove storage pool '%(ident)s'"),
+    "KCHPOOL0003L": _("Update storage pool '%(ident)s'"),
+    "KCHPOOL0004L": _("Activate storage pool '%(ident)s'"),
+    "KCHPOOL0005L": _("Deactivate storage pool '%(ident)s'"),
+    "KCHSNAP0001L": _("Create snapshot '%(name)s' at guest '%(vm)s'"),
+    "KCHSNAP0002L": _("Remove snapshot '%(ident)s' from guest '%(vm)s'"),
+    "KCHSNAP0003L": _("Revert guest '%(vm)s' to snapshot '%(ident)s'"),
+    "KCHTMPL0001L": _("Create template '%(name)s'"),
+    "KCHTMPL0002L": _("Remove template '%(ident)s'"),
+    "KCHTMPL0003L": _("Update template '%(ident)s'"),
+    "KCHTMPL0004L": _("Clone template '%(ident)s'"),
+    "KCHVM0001L": _("Create guest '%(name)s' from template '%(template)s'"),
+    "KCHVM0002L": _("Remove guest '%(ident)s'"),
+    "KCHVM0003L": _("Edit guest '%(ident)s'"),
+    "KCHVM0004L": _("Start guest '%(ident)s'"),
+    "KCHVM0005L": _("Power off guest '%(ident)s'"),
+    "KCHVM0006L": _("Shutdown guest '%(ident)s'"),
+    "KCHVM0007L": _("Restart guest '%(ident)s'"),
+    "KCHVM0008L": _("Connect to guest '%(ident)s' through novnc/spice"),
+    "KCHVM0009L": _("Clone guest '%(ident)s'"),
+    "KCHVM0010L": _("Migrate guest '%(ident)s' to '%(remote_host)s'"),
+    "KCHVM0011L": _("Suspend guest '%(ident)s'"),
+    "KCHVM0012L": _("Resume guest '%(ident)s'"),
+    "KCHVM0013L": _("Connect to guest '%(ident)s' through serial"),
+    "KCHVMHDEV0001L": _("Attach host device '%(name)s' to guest '%(vmid)s'"),
+    "KCHVMHDEV0002L": _("Detach host device '%(ident)s' from guest '%(vmid)s'"),
+    "KCHVMIF0001L": _("Attach network interface '%(network)s' to guest '%(vm)s'"),
+    "KCHVMIF0002L": _("Detach network interface '%(ident)s' from guest '%(vm)s'"),
+    "KCHVMIF0003L": _("Update network interface '%(ident)s' at guest '%(vm)s'"),
+    "KCHVMSTOR0001L": _("Attach %(type)s storage '%(path)s' to guest '%(vm)s'"),
+    "KCHVMSTOR0002L": _("Remove storage '%(ident)s' from guest '%(vm)s'"),
+    "KCHVMSTOR0003L": _("Update storage '%(ident)s' at guest '%(vm)s'"),
+    "KCHVOL0001L": _("Create storage volume '%(name)s' at pool '%(pool)s'"),
+    "KCHVOL0002L": _("Remove storage volume '%(ident)s' from pool '%(pool)s'"),
+    "KCHVOL0003L": _("Update storage volume '%(ident)s' at pool '%(pool)s'"),
+    "KCHVOL0004L": _("Wipe storage volume '%(ident)s' off pool '%(pool)s'"),
+    "KCHVOL0005L": _("Resize storage volume '%(ident)s' at pool '%(pool)s' with size %(size)s"),
+    "KCHVOL0006L": _("Clone storage volume '%(ident)s' at pool '%(pool)s'"),
 }
-- 
1.9.1




More information about the Kimchi-devel mailing list