[PATCH 3/3] python/sepolicy: Fix translated strings with parameters

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

 



When a translated string takes parameters with %, the % and the
parameters need to be after the call to the underline function in order
to work properly.

Signed-off-by: Nicolas Iooss <nicolas.iooss@xxxxxxx>
---
 python/sepolicy/sepolicy/generate.py  |  2 +-
 python/sepolicy/sepolicy/gui.py       | 28 ++++++++++++++--------------
 python/sepolicy/sepolicy/interface.py |  4 ++--
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/python/sepolicy/sepolicy/generate.py b/python/sepolicy/sepolicy/generate.py
index f885425806f1..325a3888be2b 100644
--- a/python/sepolicy/sepolicy/generate.py
+++ b/python/sepolicy/sepolicy/generate.py
@@ -191,7 +191,7 @@ def verify_ports(ports):
                 temp.append(p)
         return temp
     except ValueError:
-        raise ValueError(_("Ports must be numbers or ranges of numbers from 1 to %d " % max_port))
+        raise ValueError(_("Ports must be numbers or ranges of numbers from 1 to %d ") % max_port)
 
 
 class policy:
diff --git a/python/sepolicy/sepolicy/gui.py b/python/sepolicy/sepolicy/gui.py
index 6562aa850c98..537d5168a536 100644
--- a/python/sepolicy/sepolicy/gui.py
+++ b/python/sepolicy/sepolicy/gui.py
@@ -500,7 +500,7 @@ class SELinuxGui():
         self.all_domains.sort(key=str.lower)
 
         if app and app not in self.all_domains:
-            self.error(_("%s is not a valid domain" % app))
+            self.error(_("%s is not a valid domain") % app)
             self.quit()
 
         loading_gui.show()
@@ -1056,21 +1056,21 @@ class SELinuxGui():
         self.application_files_initialize(app)
         self.transitions_files_initialize(app)
 
-        self.executable_files_tab.set_tooltip_text(_("File path used to enter the '%s' domain." % app))
-        self.writable_files_tab.set_tooltip_text(_("Files to which the '%s' domain can write." % app))
-        self.network_out_tab.set_tooltip_text(_("Network Ports to which the '%s' is allowed to connect." % app))
-        self.network_in_tab.set_tooltip_text(_("Network Ports to which the '%s' is allowed to listen." % app))
-        self.application_files_tab.set_tooltip_text(_("File Types defined for the '%s'." % app))
-        self.boolean_radio_button.set_tooltip_text(_("Display boolean information that can be used to modify the policy for the '%s'." % app))
-        self.files_radio_button.set_tooltip_text(_("Display file type information that can be used by the '%s'." % app))
-        self.network_radio_button.set_tooltip_text(_("Display network ports to which the '%s' can connect or listen to." % app))
-        self.transitions_into_tab.set_label(_("Application Transitions Into '%s'" % app))
-        self.transitions_from_tab.set_label(_("Application Transitions From '%s'" % app))
-        self.transitions_file_tab.set_label(_("File Transitions From '%s'" % app))
+        self.executable_files_tab.set_tooltip_text(_("File path used to enter the '%s' domain.") % app)
+        self.writable_files_tab.set_tooltip_text(_("Files to which the '%s' domain can write.") % app)
+        self.network_out_tab.set_tooltip_text(_("Network Ports to which the '%s' is allowed to connect.") % app)
+        self.network_in_tab.set_tooltip_text(_("Network Ports to which the '%s' is allowed to listen.") % app)
+        self.application_files_tab.set_tooltip_text(_("File Types defined for the '%s'.") % app)
+        self.boolean_radio_button.set_tooltip_text(_("Display boolean information that can be used to modify the policy for the '%s'.") % app)
+        self.files_radio_button.set_tooltip_text(_("Display file type information that can be used by the '%s'.") % app)
+        self.network_radio_button.set_tooltip_text(_("Display network ports to which the '%s' can connect or listen to.") % app)
+        self.transitions_into_tab.set_label(_("Application Transitions Into '%s'") % app)
+        self.transitions_from_tab.set_label(_("Application Transitions From '%s'") % app)
+        self.transitions_file_tab.set_label(_("File Transitions From '%s'") % app)
         self.transitions_into_tab.set_tooltip_text(_("Executables which will transition to '%s', when executing selected domains entrypoint.") % app)
         self.transitions_from_tab.set_tooltip_text(_("Executables which will transition to a different domain, when '%s' executes them.") % app)
-        self.transitions_file_tab.set_tooltip_text(_("Files by '%s' with transitions to a different label." % app))
-        self.transitions_radio_button.set_tooltip_text(_("Display applications that can transition into or out of the '%s'." % app))
+        self.transitions_file_tab.set_tooltip_text(_("Files by '%s' with transitions to a different label.") % app)
+        self.transitions_radio_button.set_tooltip_text(_("Display applications that can transition into or out of the '%s'.") % app)
 
         self.application = app
         self.applications_selection_button.set_label(self.application)
diff --git a/python/sepolicy/sepolicy/interface.py b/python/sepolicy/sepolicy/interface.py
index c64122e5e565..18374dcfed96 100644
--- a/python/sepolicy/sepolicy/interface.py
+++ b/python/sepolicy/sepolicy/interface.py
@@ -220,7 +220,7 @@ def interface_compile_test(interface, path="/usr/share/selinux/devel/policy.xml"
     idict = get_interface_dict(path)
 
     if not (interface.split("_")[0] in exclude_interfaces or idict[interface][2] in exclude_interface_type):
-        print(_("Compiling %s interface" % interface))
+        print(_("Compiling %s interface") % interface)
         try:
             fd = open(policy_files['te'], "w")
             fd.write(generate_compile_te(interface, idict))
@@ -237,4 +237,4 @@ def interface_compile_test(interface, path="/usr/share/selinux/devel/policy.xml"
                 os.remove(v)
 
     else:
-        sys.stderr.write(_("\nCompiling of %s interface is not supported." % interface))
+        sys.stderr.write(_("\nCompiling of %s interface is not supported.") % interface)
-- 
2.16.0





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux