[gtk-vnc-devel] PATCH: Fix gtk-vnc --help is not localized



Hi,

This patch is from Takao, I remake it based on trunk. Please refer to
bug
https://sourceforge.net/tracker/index.php?func=detail&aid=2354859&group_id=190580&atid=933930
 for more detail.

Thanks,
Halton.
diff -r d68935d582f0 autogen.sh
--- a/autogen.sh	Sun Dec 07 19:56:56 2008 +0000
+++ b/autogen.sh	Thu Dec 11 11:42:23 2008 +0800
@@ -45,6 +45,7 @@
 fi
 
 libtoolize --copy --force
+intltoolize --automake -c -f
 aclocal -I gnulib/m4
 autoheader
 automake --add-missing --copy
diff -r d68935d582f0 configure.ac
--- a/configure.ac	Sun Dec 07 19:56:56 2008 +0000
+++ b/configure.ac	Thu Dec 11 11:42:23 2008 +0800
@@ -42,6 +42,13 @@
 AC_PROG_LIBTOOL
 
 AC_CHECK_HEADERS([pwd.h winsock2.h])
+
+GETTEXT_PACKAGE=gtk-vnc
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
+
+IT_PROG_INTLTOOL([0.35.0])
+AM_GLIB_GNU_GETTEXT
 
 AC_ARG_WITH(python,
 [  --with-python           build python bindings],
@@ -240,6 +247,7 @@
   src/Makefile
   examples/Makefile
   plugin/Makefile
+  po/Makefile.in
   gtk-vnc-1.0.pc
   gtk-vnc.spec
   mingw32-gtk-vnc.spec
diff -r d68935d582f0 src/vncdisplay.c
--- a/src/vncdisplay.c	Sun Dec 07 19:56:56 2008 +0000
+++ b/src/vncdisplay.c	Thu Dec 11 11:42:23 2008 +0800
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <gdk/gdkkeysyms.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
+#include <glib/gi18n-lib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -164,7 +165,7 @@
 
 static const GOptionEntry gtk_vnc_args[] =
 {
-  { "gtk-vnc-debug", 0, 0, G_OPTION_ARG_NONE, &debug_enabled, "Enables debug output", 0 },
+  { "gtk-vnc-debug", 0, 0, G_OPTION_ARG_NONE, &debug_enabled, N_("Enables debug output"), 0 },
   { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, 0 }
 };
 
@@ -2173,14 +2174,28 @@
 	return obj->priv->absolute;
 }
 
+static int translation_init ()
+{
+	static int initialized = 0;
+	if (initialized == 1)
+		return 0;
+
+	bindtextdomain (GETTEXT_PACKAGE, "/usr/share/locale");
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	return 0;
+}
+
 GOptionGroup *
 vnc_display_get_option_group (void)
 {
   GOptionGroup *group;
 
-  group = g_option_group_new ("gtk-vnc", "GTK-VNC Options", "Show GTK-VNC Options", NULL, NULL);
+  translation_init ();
+  group = g_option_group_new ("gtk-vnc", N_("GTK-VNC Options"), N_("Show GTK-VNC Options"), NULL, NULL);
 
   g_option_group_add_entries (group, gtk_vnc_args);
+  g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
   
   return group;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]