Hello community,

here is the log from the commit of package polkit for openSUSE:Factory checked 
in at 2017-06-18 13:49:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/polkit (Old)
 and      /work/SRC/openSUSE:Factory/.polkit.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "polkit"

Sun Jun 18 13:49:34 2017 rev:57 rq:503611 version:0.113

Changes:
--------
--- /work/SRC/openSUSE:Factory/polkit/polkit.changes    2016-06-12 
18:51:09.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.polkit.new/polkit.changes       2017-06-18 
13:49:58.470330488 +0200
@@ -1,0 +2,9 @@
+Tue Jun 13 15:25:58 UTC 2017 - [email protected]
+
+- Use gettext as fallback to get potential distro translations for
+  polkit actions. Similar mechnism as used for desktop file
+  translations. That way it's possible to use weblate to add
+  additional translations that are not provided by upstream
+  (polkit-gettext.patch).
+
+-------------------------------------------------------------------

New:
----
  polkit-gettext.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ polkit.spec ++++++
--- /var/tmp/diff_new_pack.hhOGqy/_old  2017-06-18 13:49:59.398199921 +0200
+++ /var/tmp/diff_new_pack.hhOGqy/_new  2017-06-18 13:49:59.402199357 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package polkit
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -36,6 +36,8 @@
 Patch1:         polkit-no-systemd.patch
 # PATCH-REVERT-UPSTREAM polkit-revert-session-magic.patch various bugs 
meissner -- systemd session magic was not updating the user seats correctly
 Patch2:         polkit-revert-session-magic.patch
+# PATCH-FIX-OPENSUSE polkit-gettext.patch [email protected] -- allow fallback to 
gettext for polkit action translations
+Patch3:         polkit-gettext.patch
 # needed for patch1
 BuildRequires:  autoconf
 # needed for patch1
@@ -131,6 +133,7 @@
 %patch1 -p1
 %endif
 %patch2 -p1 -R
+%patch3 -p1
 
 %build
 export V=1


++++++ polkit-gettext.patch ++++++
>From fea7159b7cc50deb7298b2858e125fb623012549 Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <[email protected]>
Date: Tue, 13 Jun 2017 18:28:28 +0200
Subject: [PATCH] Use gettext as fallback for translations

Upstream polkit action files do not necessarily contain translations for
all languages a distribution supports. And even if all translations are
contained in the head branch, distributions sometimes need to ship older
versions of packages. In order to allow retrofitting translations and
shipping language packs for polkit actions without having to patch and
rebuild packages gettext could be used as fallback. That way only
additional .mo files have to be installed.
So this patch makes polkit call into gettext with the domain
'polkit-action-distro-translations' if an xml doesn't contain
translations for the requested language.
---
 src/polkitbackend/polkitbackendactionpool.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/polkitbackend/polkitbackendactionpool.c 
b/src/polkitbackend/polkitbackendactionpool.c
index 3894fe9..9252788 100644
--- a/src/polkitbackend/polkitbackendactionpool.c
+++ b/src/polkitbackend/polkitbackendactionpool.c
@@ -24,6 +24,7 @@
 #include <pwd.h>
 #include <string.h>
 #include <expat.h>
+#include <locale.h>
 
 #include <polkit/polkit.h>
 #include <polkit/polkitprivate.h>
@@ -1132,8 +1133,20 @@ _localize (GHashTable *translations,
   if (result != NULL)
     goto out;
 
-  /* fall back to untranslated */
-  result = untranslated;
+  /* try distro provided language bundle via gettext */
+
+  /* Set LANG and locale so g_dgettext() + friends work below */
+  if (setlocale (LC_ALL, lang) == NULL)
+    {
+      g_printerr ("Invalid locale '%s'\n", lang);
+    }
+  g_setenv ("LANG", lang, TRUE);
+
+  result = g_dgettext ("polkit-action-distro-translations", untranslated);
+
+  /* Back to C! */
+  setlocale (LC_ALL, "C");
+  g_setenv ("LANG", "C", TRUE);
 
 out:
   return result;
-- 
2.12.2



Reply via email to