[libvirt] [PATCH glib 2/2] Add framework for i18n of error message strings

Christophe Fergeau cfergeau at redhat.com
Wed Apr 10 08:57:08 UTC 2013


Hey,

On Mon, Apr 08, 2013 at 01:54:21PM +0100, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  .gitignore                                   |  7 +++++
>  Makefile.am                                  |  2 +-
>  autogen.sh                                   | 28 ++++++------------
>  configure.ac                                 |  7 +++++
>  libvirt-gconfig/libvirt-gconfig-helpers.c    |  7 +++--
>  libvirt-gconfig/libvirt-gconfig-object.c     | 11 +++----
>  libvirt-gobject/libvirt-gobject-connection.c | 44 +++++++++++++++-------------
>  libvirt-gobject/libvirt-gobject-stream.c     | 14 +++++----
>  po/POTFILES.in                               |  4 +++
>  9 files changed, 69 insertions(+), 55 deletions(-)
>  create mode 100644 po/POTFILES.in
> 
> diff --git a/configure.ac b/configure.ac
> index 7b5a092..6314a7b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -60,6 +60,12 @@ PKG_CHECK_MODULES(GOBJECT2, gobject-2.0 >= $GLIB2_REQUIRED)
>  PKG_CHECK_MODULES(GIO2, gio-2.0 >= $GLIB2_REQUIRED)
>  PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED)
>  
> +LIBVIRT_GLIB_GETTEXT
> +dnl Should be in m4/virt-gettext.m4 but intltoolize is too

This macro/file are missing from this patch.

> diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c b/libvirt-gconfig/libvirt-gconfig-helpers.c
> index 9726dd4..4dfd246 100644
> --- a/libvirt-gconfig/libvirt-gconfig-helpers.c
> +++ b/libvirt-gconfig/libvirt-gconfig-helpers.c
> @@ -26,6 +26,7 @@
>  #include <string.h>
>  
>  #include <libxml/xmlerror.h>
> +#include <glib/gi18n.h>

In a library you should use glib/gi18n-lib.h along with a GETTEXT_PACKAGE
preprocessor define so that the translated string are looked up in the
library gettext domain, and not in the application gettext domain, see
https://developer.gnome.org/glib/2.31/glib-I18N.html but it does not have a
lot of details on that.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130410/c5835e46/attachment-0001.sig>


More information about the libvir-list mailing list