[libvirt] [PATCH 2/3] virsh: avoid i18n puzzle

Pino Toscano ptoscano at redhat.com
Wed Aug 24 14:14:24 UTC 2016


Use the full versions of the message, instead of composing a base
message with what was updated; the change makes the messages properly
translatable, since different parts of a sentence might need different
declensions for example.
---
 tools/virsh-network.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 1698041..eec7faf 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -907,7 +907,6 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
     bool config = vshCommandOptBool(cmd, "config");
     bool live = vshCommandOptBool(cmd, "live");
     unsigned int flags = VIR_NETWORK_UPDATE_AFFECT_CURRENT;
-    const char *affected;
 
     VSH_EXCLUSIVE_OPTIONS("current", "live");
     VSH_EXCLUSIVE_OPTIONS("current", "config");
@@ -978,19 +977,22 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
 
     if (config) {
         if (live)
-            affected = _("persistent config and live state");
+            vshPrint(ctl, _("Updated network %s persistent config and live state"),
+                     virNetworkGetName(network));
         else
-            affected = _("persistent config");
+            vshPrint(ctl, _("Updated network %s persistent config"),
+                     virNetworkGetName(network));
     } else if (live) {
-            affected = _("live state");
+        vshPrint(ctl, _("Updated network %s live state"),
+                 virNetworkGetName(network));
     } else if (virNetworkIsActive(network)) {
-        affected = _("live state");
+        vshPrint(ctl, _("Updated network %s live state"),
+                 virNetworkGetName(network));
     } else {
-        affected = _("persistent config");
+        vshPrint(ctl, _("Updated network %s persistent config"),
+                 virNetworkGetName(network));
     }
 
-    vshPrint(ctl, _("Updated network %s %s"),
-             virNetworkGetName(network), affected);
     ret = true;
  cleanup:
     vshReportError(ctl);
-- 
2.7.4




More information about the libvir-list mailing list