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

Re: [virt-tools-list] [libosinfo v2 1/4] Add translation framework



On Tue, Oct 23, 2012 at 04:54:52AM +0300, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>
> 
> Note that we are calling bindtextdomain() from Loader's class init.
> AFAICT, its a common practice in libraries without any main _init()
> function to make this call in init of the most common/useful class (e.g
> gdk-pixbuf and gdbus).

glib tries to do it every time a gettext function is called, but it's
indeed a different situation as there is no clear entry point in glib.
You are missing
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif
though

> diff --git a/autogen.sh b/autogen.sh
> index b5997e6..3255713 100755
> --- a/autogen.sh
> +++ b/autogen.sh
> @@ -18,3 +18,4 @@ which gnome-autogen.sh || {
>  }
>  
>  ACLOCAL_FLAGS="$ACLOCAL_FLAGS" USE_GNOME2_MACROS=1 . gnome-autogen.sh --enable-gtk-doc "$@"
> +intltoolize -f
> diff --git a/configure.ac b/configure.ac
> index f021fb6..97f295c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -12,6 +12,14 @@ LIBOSINFO_COMPILE_WARNINGS
>  GNOME_MAINTAINER_MODE_DEFINES
>  AM_MAINTAINER_MODE([enable])
>  
> +# i18 support
> +IT_PROG_INTLTOOL(0.40.0)
> +
> +GETTEXT_PACKAGE=AC_PACKAGE_NAME
> +AC_SUBST(GETTEXT_PACKAGE)
> +AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The name of the gettext domain])
> +AM_GLIB_GNU_GETTEXT

I think AM_GLIB_GNU_GETTEXT is deprecated these days
http://blogs.gnome.org/jjardon/2010/10/08/use-upstream-gettext-instead-the-glib-one/

> diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c
> index 65454d7..31bfeea 100644
> --- a/tools/osinfo-db-validate.c
> +++ b/tools/osinfo-db-validate.c
> @@ -26,6 +26,7 @@
>  #include <glib.h>
>  #include <gio/gio.h>
>  #include <libxml/relaxng.h>
> +#include <locale.h>
>  
>  #define SCHEMA PKGDATADIR "/schemas/libosinfo.rng"
>  
> @@ -248,6 +249,7 @@ gint main(gint argc, gchar **argv)
>      GError *error = NULL;
>      gint ret = EXIT_FAILURE;
>  
> +    setlocale(LC_ALL, "");
>      g_type_init();

Standalone binaries generally use
  setlocale (LC_ALL, "");
  textdomain (GETTEXT_PACKAGE);

  bindtextdomain (GETTEXT_PACKAGE, GLIB_LOCALE_DIR);

#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif

Christophe

Attachment: pgpWgLrozwDcs.pgp
Description: PGP signature


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