libbonobo (2.24.3-1) 20_server-files-gettext.patch

Summary

 activation-server/object-directory-load.c         |    5 ++++-
 bonobo-activation/bonobo-activation-server-info.c |   19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

    
download this patch

Patch contents

diff -Nur libbonobo-2.20.3/activation-server/object-directory-load.c libbonobo-2.20.3.new/activation-server/object-directory-load.c
--- libbonobo-2.20.3/activation-server/object-directory-load.c	2007-12-22 21:34:50.000000000 +0100
+++ libbonobo-2.20.3.new/activation-server/object-directory-load.c	2008-01-28 16:51:06.000000000 +0100
@@ -133,6 +133,7 @@
         const char *type = NULL;
         const char *location = NULL;
         const char *att, *val;
+        const char *domain = NULL;
         char *error;
         int i = 0;
 
@@ -152,6 +153,8 @@
                                 type = val;
                         else if (!location && !strcmp (att, "location"))
                                 location = val;
+                        else if (!domain && ((!strcmp (att, "debian-gettext-domain")) || (!strcmp (att, "ubuntu-gettext-domain"))))
+                                domain = val;
                 }
                 
         } while (att && val);
@@ -202,7 +205,7 @@
         info->cur_server->location_info = CORBA_string_dup (location);
         info->cur_server->hostname = CORBA_string_dup (info->host);
         info->cur_server->username = CORBA_string_dup (g_get_user_name ());
-        info->cur_server->domain = CORBA_string_dup ("unused");
+        info->cur_server->domain = CORBA_string_dup (domain ?  domain : "");
 
 #ifdef G_OS_WIN32
         if (!strcmp (type, "exe") || !strcmp (type, "shlib"))
diff -Nur libbonobo-2.20.3/bonobo-activation/bonobo-activation-server-info.c libbonobo-2.20.3.new/bonobo-activation/bonobo-activation-server-info.c
--- libbonobo-2.20.3/bonobo-activation/bonobo-activation-server-info.c	2007-12-22 21:34:50.000000000 +0100
+++ libbonobo-2.20.3.new/bonobo-activation/bonobo-activation-server-info.c	2008-01-28 16:53:36.000000000 +0100
@@ -29,6 +29,7 @@
 #include <bonobo-activation/bonobo-activation-server-info.h>
 
 #include <string.h>
+#include <libintl.h>
 
 /**
  * bonobo_server_info_prop_find:
@@ -74,6 +75,24 @@
         char *prop_name_buf;
                      
 	if (i18n_languages) {
+                if (server->domain && *server->domain) {
+                    const char *value = bonobo_server_info_prop_lookup (server, prop_name, NULL);
+                    if (value) {
+                        const char *translated_value;
+
+                        translated_value = dgettext (server->domain, value);
+
+                        if (translated_value != value) {
+                                if (bind_textdomain_codeset (server->domain, NULL))
+                                        translated_value = g_strdup (translated_value);
+                                else
+                                        translated_value = g_locale_to_utf8 (translated_value, -1, NULL, NULL, NULL);
+
+                                return translated_value;
+                        }
+                    }
+                }
+
 		for (cur = i18n_languages; cur; cur = cur->next) {
                         prop_name_buf = g_strdup_printf ("%s-%s", prop_name, (char *) cur->data);