Blame SOURCES/oscap-anaconda-addon-2.0.1-fix_strings-PR_207.patch

a0903e
From 1b96504a8bbc198cce11647a0c3a65e1a3ffaba1 Mon Sep 17 00:00:00 2001
a0903e
From: Matej Tyc <matyc@redhat.com>
a0903e
Date: Fri, 13 May 2022 14:44:45 +0200
a0903e
Subject: [PATCH] Fix strings for translations
a0903e
a0903e
The input of the _() function has to be a static string,
a0903e
and it was in those cases a formatted one,
a0903e
which didn't match the translation data.
a0903e
---
a0903e
 org_fedora_oscap/rule_handling.py | 20 ++++++++++----------
a0903e
 1 file changed, 10 insertions(+), 10 deletions(-)
a0903e
a0903e
diff --git a/org_fedora_oscap/rule_handling.py b/org_fedora_oscap/rule_handling.py
a0903e
index 244aac8..635446e 100644
a0903e
--- a/org_fedora_oscap/rule_handling.py
a0903e
+++ b/org_fedora_oscap/rule_handling.py
a0903e
@@ -707,10 +707,11 @@ def eval_rules(self, ksdata, storage, report_only=False):
a0903e
         messages = []
a0903e
         packages_data = get_packages_data()
a0903e
 
a0903e
+        msg_installed_template = _(
a0903e
+            "package '%s' has been added to the list of to be installed packages")
a0903e
         # add messages for the already added packages
a0903e
         for pkg in self._added_pkgs:
a0903e
-            msg = _("package '%s' has been added to the list of to be installed "
a0903e
-                    "packages" % pkg)
a0903e
+            msg = msg_installed_template % pkg
a0903e
             messages.append(RuleMessage(self.__class__,
a0903e
                                         common.MESSAGE_TYPE_INFO, msg))
a0903e
 
a0903e
@@ -724,11 +725,12 @@ def eval_rules(self, ksdata, storage, report_only=False):
a0903e
                 self._added_pkgs.add(pkg)
a0903e
                 packages_data.packages.append(pkg)
a0903e
 
a0903e
-            msg = _("package '%s' has been added to the list of to be installed "
a0903e
-                    "packages" % pkg)
a0903e
+            msg = msg_installed_template % pkg
a0903e
             messages.append(RuleMessage(self.__class__,
a0903e
                                         common.MESSAGE_TYPE_INFO, msg))
a0903e
 
a0903e
+        msg_excluded_template = _(
a0903e
+            "package '%s' has been added to the list of excluded packages")
a0903e
         # now do the same for the packages that should be excluded
a0903e
         # add messages for the already excluded packages
a0903e
         for pkg in self._removed_pkgs:
a0903e
@@ -736,13 +738,12 @@ def eval_rules(self, ksdata, storage, report_only=False):
a0903e
                 msg = _(
a0903e
                     "package '{package}' has been added to the list "
a0903e
                     "of excluded packages, but it can't be removed "
a0903e
-                    "from the current software selection without breaking the installation."
a0903e
-                    .format(package=pkg))
a0903e
+                    "from the current software selection without breaking the installation.")
a0903e
+                msg = msg.format(package=pkg)
a0903e
                 messages.append(RuleMessage(self.__class__,
a0903e
                                             common.MESSAGE_TYPE_FATAL, msg))
a0903e
             else:
a0903e
-                msg = _("package '%s' has been added to the list of excluded "
a0903e
-                        "packages" % pkg)
a0903e
+                msg = msg_excluded_template % pkg
a0903e
                 messages.append(RuleMessage(self.__class__,
a0903e
                                             common.MESSAGE_TYPE_INFO, msg))
a0903e
 
a0903e
@@ -756,8 +757,7 @@ def eval_rules(self, ksdata, storage, report_only=False):
a0903e
                 self._removed_pkgs.add(pkg)
a0903e
                 packages_data.excluded_packages.append(pkg)
a0903e
 
a0903e
-            msg = _("package '%s' has been added to the list of excluded "
a0903e
-                    "packages" % pkg)
a0903e
+            msg = msg_excluded_template % pkg
a0903e
             messages.append(RuleMessage(self.__class__,
a0903e
                                         common.MESSAGE_TYPE_INFO, msg))
a0903e