File: xubuntu_desktop-x-ubuntu-gettext.patch

package info (click to toggle)
libxfce4util 4.20.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 4,568 kB
  • sloc: ansic: 5,483; sh: 5,064; makefile: 229; python: 128; sed: 16
file content (40 lines) | stat: -rw-r--r-- 1,286 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Description: retrieve translations with the X-Ubuntu-Gettext-Domain key
 Display translations for patched desktop files from Ubuntu whose
 translations are stored in a different place ("X-Ubuntu-Gettext-Domain"
 key is used to find it).
Author: Lionel Le Folgoc <mrpouit@ubuntu.com>
Forwarded: not-needed

--- a/libxfce4util/xfce-rc.c
+++ b/libxfce4util/xfce-rc.c
@@ -555,10 +555,30 @@ xfce_rc_read_entry (const XfceRc *rc,
 {
   const gchar *value;
 
+#ifdef UBUNTU
+  gboolean     has_gettext_domain;
+  const gchar *gettext_domain;
+#endif
+
   g_return_val_if_fail (rc != NULL, fallback);
   g_return_val_if_fail (rc->read_entry != NULL, fallback);
   g_return_val_if_fail (key != NULL, fallback);
 
+#ifdef UBUNTU
+  has_gettext_domain = xfce_rc_has_entry (rc, "X-Ubuntu-Gettext-Domain");
+
+  if (has_gettext_domain == TRUE && (strcmp (key, "Name") == 0 || strcmp (key, "GenericName") == 0 || strcmp (key, "Comment") == 0))
+  {
+    gettext_domain = (*rc->read_entry) (rc, "X-Ubuntu-Gettext-Domain", FALSE);
+
+    if (gettext_domain != NULL)
+    {
+      value = dgettext (gettext_domain, xfce_rc_read_entry_untranslated (rc, key, fallback));
+      return value;
+    }
+  }
+#endif
+
   value = (*rc->read_entry) (rc, key, TRUE);
   if (value == NULL)
     value = fallback;