OBS User unknown 2008-08-13 22:51:18 +00:00 committed by Git OBS Bridge
parent 8ed85fa26a
commit e035e7e1df
6 changed files with 180 additions and 3918 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ca079e878affd9cae0490c218d52f60bcb0681172f646c76cd2399802a545cb3
size 1425318

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c785e6769255ae2d4aa3fb7ca76ea75c8833370ec118880a119b6688638f71d9
size 1510062

View File

@ -0,0 +1,134 @@
Add support of gettext for desktop entry files.
We only support this for the following keys: Name, GenericName, Comment. We
don't support all keys because it can create issues for the Icon key (which is
localizable -- which can result in a broken icon).
Translations that are present in the desktop entry take precedence over
translations via gettext. If we don't do this, then user modifications won't
appear since they will have lower precedence.
Index: gnome-desktop-2.23.4/libgnome-desktop/gnome-desktop-item.c
===================================================================
--- gnome-desktop-2.23.4.orig/libgnome-desktop/gnome-desktop-item.c
+++ gnome-desktop-2.23.4/libgnome-desktop/gnome-desktop-item.c
@@ -84,6 +84,7 @@ struct _GnomeDesktopItem {
GHashTable *main_hash;
char *location;
+ const char *gettext_domain;
time_t mtime;
@@ -139,6 +140,8 @@ static GnomeDesktopItem *gnome_desktop_i
static void update_recently_used_apps (const GnomeDesktopItem *item);
+static const char *lookup (const GnomeDesktopItem *item, const char *key);
+
static int
readbuf_getc (ReadBuf *rb)
{
@@ -399,6 +402,7 @@ gnome_desktop_item_new (void)
"1.0");
retval->launch_time = 0;
+ retval->gettext_domain = NULL;
return retval;
}
@@ -477,6 +481,8 @@ gnome_desktop_item_copy (const GnomeDesk
copy_string_hash,
retval->main_hash);
+ retval->gettext_domain = lookup (retval, GNOME_DESKTOP_ITEM_GETTEXT_DOMAIN);
+
return retval;
}
@@ -924,6 +930,9 @@ gnome_desktop_item_unref (GnomeDesktopIt
g_free (item->location);
item->location = NULL;
+ /* no need to free it, it's a const key */
+ item->gettext_domain = NULL;
+
g_free (item);
}
@@ -999,16 +1008,51 @@ lookup (const GnomeDesktopItem *item, co
static const char *
lookup_locale (const GnomeDesktopItem *item, const char *key, const char *locale)
{
+ const char *ret;
+
+ ret = NULL;
+
if (locale == NULL ||
strcmp (locale, "C") == 0) {
- return lookup (item, key);
+ ret = lookup (item, key);
} else {
- const char *ret;
char *full = g_strdup_printf ("%s[%s]", key, locale);
ret = lookup (item, full);
g_free (full);
- return ret;
}
+
+ /* we're only interested in gettext translation if we don't have a
+ * translation in the .desktop file itself and if the key is one of the
+ * keys we know we want to translate: Name, GenericName, Comment.
+ * Blindly doing this for all keys can give strange result for the
+ * icons, since the Icon is a locale string in the spec, eg. */
+ if (!ret && item->gettext_domain &&
+ (strcmp (key, GNOME_DESKTOP_ITEM_NAME) == 0 ||
+ strcmp (key, GNOME_DESKTOP_ITEM_GENERIC_NAME) == 0 ||
+ strcmp (key, GNOME_DESKTOP_ITEM_COMMENT) == 0)) {
+ const char *msg_locale = setlocale (LC_MESSAGES, NULL);
+
+ /* only get translation in the mo file if the requested locale
+ * is the LC_MESSAGES one. Ideally, we should do more and
+ * change LC_MESSAGES to use the requested locale, but there's
+ * no guarantee it's installed on the system and it might have
+ * some side-effects. Since this is a corner case, let's ignore
+ * it. */
+ if (msg_locale && locale &&
+ strcmp (msg_locale, locale) == 0) {
+ const char *value = lookup (item, key);
+ if (value != NULL && value[0] != '\0') {
+ ret = dgettext (item->gettext_domain, value);
+ /* don't accept no translation, since we might
+ * have something better later, with another
+ * locale */
+ if (ret == value)
+ ret = NULL;
+ }
+ }
+ }
+
+ return ret;
}
static const char *
@@ -4039,6 +4083,8 @@ ditem_load (ReadBuf *rb,
readbuf_close (rb);
+ item->gettext_domain = lookup (item, GNOME_DESKTOP_ITEM_GETTEXT_DOMAIN);
+
return item;
}
Index: gnome-desktop-2.23.4/libgnome-desktop/libgnome/gnome-desktop-item.h
===================================================================
--- gnome-desktop-2.23.4.orig/libgnome-desktop/libgnome/gnome-desktop-item.h
+++ gnome-desktop-2.23.4/libgnome-desktop/libgnome/gnome-desktop-item.h
@@ -98,6 +98,7 @@ typedef struct _GnomeDesktopItem GnomeDe
#define GNOME_DESKTOP_ITEM_DOC_PATH "X-GNOME-DocPath" /* string */
#define GNOME_DESKTOP_ITEM_SUBSTITUTEUID "X-KDE-SubstituteUID" /*boolean*/
#define GNOME_DESKTOP_ITEM_ROOT_ONLY "X-KDE-RootOnly" /*boolean*/
+#define GNOME_DESKTOP_ITEM_GETTEXT_DOMAIN "X-SUSE-Gettext-Domain" /* string */
/* The vfolder proposal */
#define GNOME_DESKTOP_ITEM_CATEGORIES "Categories" /* string */
#define GNOME_DESKTOP_ITEM_ONLY_SHOW_IN "OnlyShowIn" /* string */

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Tue Aug 5 18:43:47 CEST 2008 - rodrigo@suse.de
- Update to version 2.23.6:
+ Fix build with gcc 2.x (Jens Granseuer)
+ GnomeBG: fix handling of empty filenames (Soren Sandmann)
+ GnomeBG: word around non-atomic gconf for emitting changed signals
only once (Soren Sandmann)
- Remove upstreamed randr1.2 patch
-------------------------------------------------------------------
Mon Jul 28 23:56:29 CEST 2008 - vuntz@novell.com
- Add gnome-desktop-fate300461-desktop-gettext.patch to support
translation of desktop entries via gettext. This is part of
fate#300461
-------------------------------------------------------------------
Mon Jul 7 15:41:10 CEST 2008 - ro@suse.de

View File

@ -1,10 +1,17 @@
#
# spec file for package gnome-desktop (Version 2.23.4)
# spec file for package gnome-desktop (Version 2.23.6)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
@ -16,8 +23,8 @@ BuildRequires: fdupes gnome-common gnome-doc-utils gnome-doc-utils-devel gtk-do
License: GNU Free Documentation License, Version 1.1 (GFDL 1.1); GPL v2 or later; LGPL v2.1 or later
Group: System/GUI/GNOME
Obsoletes: gnome-core
Version: 2.23.4
Release: 5
Version: 2.23.6
Release: 1
Summary: The GNOME Desktop API Library
Source: %{name}-%{version}.tar.bz2
Url: http://www.gnome.org
@ -27,8 +34,8 @@ Patch1: X-KDE-SubstituteUID.dif
Patch2: gnome-desktop-desktop.patch
# PATCH-FEATURE-OPENSUSE gnome-desktop-recently-used-apps.patch -- Add launched .desktop files to recently used apps.
Patch3: gnome-desktop-recently-used-apps.patch
# PATCH-FEATURE-UPSTREAM gnome-desktop-randr-1.2.diff -- Add support for RandR 1.2 to the libraries. federico@novell.com
Patch4: gnome-desktop-randr-1.2.diff
# PATCH-FEATURE-OPENSUSE gnome-desktop-fate300461-desktop-gettext.patch fate300461 vuntz@novell.com -- Look for translation of desktop entry strings via gettext
Patch5: gnome-desktop-fate300461-desktop-gettext.patch
Requires: %{name}-lang = %{version}
Requires: libgnome-desktop-2-7 = %{version}
@ -123,7 +130,7 @@ Authors:
%patch1
%patch2 -p0
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
autoreconf -f -i
@ -182,6 +189,17 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/gtk-doc/html/gnome-desktop
%changelog
* Tue Aug 05 2008 rodrigo@suse.de
- Update to version 2.23.6:
+ Fix build with gcc 2.x (Jens Granseuer)
+ GnomeBG: fix handling of empty filenames (Soren Sandmann)
+ GnomeBG: word around non-atomic gconf for emitting changed signals
only once (Soren Sandmann)
- Remove upstreamed randr1.2 patch
* Tue Jul 29 2008 vuntz@novell.com
- Add gnome-desktop-fate300461-desktop-gettext.patch to support
translation of desktop entries via gettext. This is part of
fate#300461
* Mon Jul 07 2008 ro@suse.de
- update baselibs.conf
(it is called libgnome-desktop-2-7 by now)