Hello,
please disregard this patch. I am working on an improved solution for
the issue based on module namespaces.
Sorry for the noise.
On 5/3/22 13:42, Vit Mojzis wrote:
The policy is generated using sepolicy.generate, but since its
translations are in a different translation domain (selinux-python as
opposed to selinux-gui), the confirmation dialog is not translated.
- Add selinux-python as a fallback translation domain
- Set the whole "generate()" confirmation as translatable
- Drop "codeset" parameter since it is deprecated
Signed-off-by: Vit Mojzis <vmojzis@xxxxxxxxxx>
---
gui/polgengui.py | 7 +++++--
python/sepolicy/sepolicy/generate.py | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/gui/polgengui.py b/gui/polgengui.py
index 01f541ba..dcd5df47 100644
--- a/gui/polgengui.py
+++ b/gui/polgengui.py
@@ -69,10 +69,13 @@ try:
kwargs = {}
if sys.version_info < (3,):
kwargs['unicode'] = True
- gettext.install(PROGNAME,
+ t = gettext.translation(PROGNAME,
localedir="/usr/share/locale",
- codeset='utf-8',
**kwargs)
+ t.install()
+ t.add_fallback(gettext.translation("selinux-python",
+ localedir="/usr/share/locale",
+ **kwargs))
except:
try:
import builtins
diff --git a/python/sepolicy/sepolicy/generate.py b/python/sepolicy/sepolicy/generate.py
index 43180ca6..42d52109 100644
--- a/python/sepolicy/sepolicy/generate.py
+++ b/python/sepolicy/sepolicy/generate.py
@@ -1372,7 +1372,7 @@ Warning %s does not exist
fd.close()
def generate(self, out_dir=os.getcwd()):
- out = "Created the following files:\n"
+ out = _("Created the following files:\n")
out += "%s # %s\n" % (self.write_te(out_dir), _("Type Enforcement file"))
out += "%s # %s\n" % (self.write_if(out_dir), _("Interface file"))
out += "%s # %s\n" % (self.write_fc(out_dir), _("File Contexts file"))