[Xfce4-commits] <xfce4-panel:master> Bind panel translation domain for external plugins (bug #6932).

Nick Schermer noreply at xfce.org
Sat Dec 11 13:44:01 CET 2010


Updating branch refs/heads/master
         to 0879ad66d690e7bb81206614cbf2aa1c352d859b (commit)
       from f593d16351743a9f8918d7c02ee279a15fa9a04c (commit)

commit 0879ad66d690e7bb81206614cbf2aa1c352d859b
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Dec 11 13:43:12 2010 +0100

    Bind panel translation domain for external plugins (bug #6932).

 configure.ac.in                   |    4 +++-
 libxfce4panel/Makefile.am         |    1 +
 libxfce4panel/xfce-panel-plugin.c |   14 ++++++++++++++
 3 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 3c1a34b..e86edc6 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -91,7 +91,9 @@ dnl *** Check for standard headers ***
 dnl **********************************
 AC_HEADER_STDC()
 AC_CHECK_HEADERS([stdlib.h unistd.h locale.h stdio.h errno.h time.h string.h \
-                  math.h sys/types.h sys/wait.h memory.h signal.h sys/prctl.h])
+                  math.h sys/types.h sys/wait.h memory.h signal.h sys/prctl.h \
+                  libintl.h])
+AC_CHECK_FUNCS([bind_textdomain_codeset])
 
 dnl ******************************
 dnl *** Check for i18n support ***
diff --git a/libxfce4panel/Makefile.am b/libxfce4panel/Makefile.am
index 1a0fb7b..29c3f8b 100644
--- a/libxfce4panel/Makefile.am
+++ b/libxfce4panel/Makefile.am
@@ -3,6 +3,7 @@ INCLUDES = \
 	-I$(top_srcdir) \
 	-DG_LOG_DOMAIN=\"libxfce4panel\" \
 	-DLIBXFCE4PANEL_COMPILATION \
+	-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
 	$(PLATFORM_CPPFLAGS)
 
 lib_LTLIBRARIES = \
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 4c9323c..e0b039f 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -20,6 +20,13 @@
 #include <config.h>
 #endif
 
+#ifdef HAVE_LIBINTL_H
+#include <libintl.h>
+#endif
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
 #include <gtk/gtk.h>
 #include <glib.h>
 #include <libxfce4util/libxfce4util.h>
@@ -583,6 +590,13 @@ xfce_panel_plugin_init (XfcePanelPlugin *plugin)
   plugin->priv->locked = TRUE;
   plugin->priv->menu_items = NULL;
 
+  /* bind the text domain of the panel so our strings
+   * are properly translated in the old 4.6 panel plugins */
+  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+
   /* hide the event box window to make the plugin transparent */
   gtk_event_box_set_visible_window (GTK_EVENT_BOX (plugin), FALSE);
 }



More information about the Xfce4-commits mailing list