[virt-tools-list] [libosinfo v6 1/4] Add translation framework

Michal Privoznik mprivozn at redhat.com
Mon Oct 29 15:55:40 UTC 2012


On 29.10.2012 15:43, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at 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).
> ---
>  .gitignore                    | 15 +++++++++++++++
>  Makefile.am                   | 28 +++++++++++++++++++++++++++-
>  autogen.sh                    |  1 +
>  configure.ac                  | 10 ++++++++++
>  osinfo/Makefile.am            |  1 +
>  osinfo/osinfo_loader.c        |  4 ++++
>  tools/Makefile.am             |  1 +
>  tools/osinfo-db-validate.c    |  7 +++++++
>  tools/osinfo-detect.c         |  7 +++++++
>  tools/osinfo-install-script.c |  7 +++++++
>  tools/osinfo-query.c          |  7 +++++++
>  11 files changed, 87 insertions(+), 1 deletion(-)
>  create mode 100644 po/POTFILES.in

ACK

> diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c
> index 65454d7..5b7274b 100644
> --- a/tools/osinfo-db-validate.c
> +++ b/tools/osinfo-db-validate.c
> @@ -26,6 +26,8 @@
>  #include <glib.h>
>  #include <gio/gio.h>
>  #include <libxml/relaxng.h>
> +#include <locale.h>
> +#include <glib/gi18n.h>
>  
>  #define SCHEMA PKGDATADIR "/schemas/libosinfo.rng"
>  
> @@ -248,6 +250,11 @@ gint main(gint argc, gchar **argv)
>      GError *error = NULL;
>      gint ret = EXIT_FAILURE;
>  
> +    setlocale(LC_ALL, "");
> +    textdomain (GETTEXT_PACKAGE);
> +    bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
> +    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
> +
>      g_type_init();
>  
>      context = g_option_context_new("- Validate XML documents ");

Okay, this is reasonable compromise. I mean, application should have
been using this already, right?

Michal




More information about the virt-tools-list mailing list