[virt-manager PATCH 1/9] i18n: fix string puzzle in volume creation dialog

Pino Toscano ptoscano at redhat.com
Thu Sep 17 06:43:58 UTC 2020


Use a single label to show the single sentence describing the available
space on the storage pool. This avoids the use of 3 different labels,
partially translated separately, and whose content cannot be moved.

Signed-off-by: Pino Toscano <ptoscano at redhat.com>
---
 ui/createvol.ui          | 45 +++++-----------------------------------
 virtManager/createvol.py |  9 ++++----
 2 files changed, 10 insertions(+), 44 deletions(-)

diff --git a/ui/createvol.ui b/ui/createvol.ui
index 80edcc26..a77048f4 100644
--- a/ui/createvol.ui
+++ b/ui/createvol.ui
@@ -260,51 +260,16 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkBox" id="hbox6">
+                                  <object class="GtkLabel" id="vol-parent-info">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="spacing">3</property>
-                                    <child>
-                                      <object class="GtkLabel" id="vol-parent-name">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="label">(parent-name)</property>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="label12">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="label" translatable="yes">available space:</property>
-                                        <property name="use_markup">True</property>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel" id="vol-parent-space">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="label">(space)</property>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">2</property>
-                                      </packing>
-                                    </child>
+                                    <property name="halign">start</property>
+                                    <property name="label"><b>pool's</b> available space: X GiB</property>
+                                    <property name="use_markup">True</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
-                                    <property name="fill">False</property>
+                                    <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
diff --git a/virtManager/createvol.py b/virtManager/createvol.py
index 91dd7743..2715237f 100644
--- a/virtManager/createvol.py
+++ b/virtManager/createvol.py
@@ -144,10 +144,11 @@ class vmmCreateVolume(vmmGObjectUI):
         self.widget("vol-capacity").set_range(0.1, 1000000)
         self.widget("vol-capacity").set_value(default_cap)
 
-        self.widget("vol-parent-name").set_markup(
-                        "<b>" + self._parent_pool.get_name() + "'s</b>")
-        self.widget("vol-parent-space").set_text(
-                        self._parent_pool.get_pretty_available())
+        self.widget("vol-parent-info").set_markup(
+                        _("<b>%(volume)s's</b> available space: %(size)s") % {
+                            "volume": self._parent_pool.get_name(),
+                            "size": self._parent_pool.get_pretty_available(),
+                        })
 
 
     ###################
-- 
2.26.2




More information about the virt-tools-list mailing list