Re: i18n issue with some GNOME libraries



I think that glib uses this solution so I suppose it's a good one (I'm 
using it also at libgda).

Cheers.


El mié, 24-04-2002 a las 21:16, Zbigniew Chyla escribió:
> 
> 
> Currently almost all GNOME 2 components expect translated strings to be
> encoded in UTF-8. That's why GNOME libraries/applications call
> bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8") in their *_init/main
> functions. The problem is that some libraries (gal, libgnomeprint,
> libgnomeprintui, eel, etc.) don't have *_init functions and gettext()
> returns translation converted to locale's encoding by default.
> The only solution I can think of is to implement <library_name>_gettext
> function in every such library:
> 
> char *
> <library_name>_gettext (const char *msgid)
> {
> 	static gboolean initialized = FALSE;
> 
> 	if (!initialized) {
> 		bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);  
> 		bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
> 		initialized = TRUE;
> 	}
> 
> 	return dgettext (GETTEXT_PACKAGE, msgid);
> }
> 
> and then add the following lines:
> 
> #include <bonobo/bonobo-i18n.h>
> #undef _
> #define _(String) <library_name>_gettext (String)
> 
> to some internal header file, included from all *.c files.
> 
> Let me know if you have a better way to work around this. Otherwise, please
> approve the attached patches (for libgnomeprintui and gal).
> 
> 
> Zbigniew
> ----
> 

> diff -ruN libgnomeprintui/ChangeLog libgnomeprintui-test/ChangeLog
> --- libgnomeprintui/ChangeLog	Fri Apr 19 23:47:55 2002
> +++ libgnomeprintui-test/ChangeLog	Wed Apr 24 16:46:48 2002
> @@ -0,0 +1,29 @@
> +2002-04-24  Zbigniew Chyla  <cyba gnome pl>
> +
> +	i18n fixes
> +
> +	* libgnomeprintui/Makefile.am (libgnomeprintui_2_la_SOURCES):
> +	Added gnome-print-i18n.c.
> +
> +	* libgnomeprintui/gnome-print-i18n.c
> +	New file with libgnomeprint_gettext() function inside.
> +
> +	* libgnomeprintui/gnome-print-i18n.h:
> +	Removed #defines cut&pasted from gnome-i18n.h/bonobo-i18n.h,
> +	included <bonobo/bonobo-i18n.h> and defined _() macro as
> +	libgnomeprint_gettext() function call.
> +
> +	* libgnomeprintui/gnome-font-dialog.c, 
> +	libgnomeprintui/gnome-print-copies.c,
> +	libgnomeprintui/gnome-print-dialog.c,
> +	libgnomeprintui/gnome-print-master-preview.c,
> +	libgnomeprintui/gnome-print-paper-selector.c,
> +	libgnomeprintui/gnome-printer-dialog.c,
> +	libgnomeprintui/gpaui/add-printer-dialog.c,
> +	libgnomeprintui/gpaui/config-dialog.c,
> +	libgnomeprintui/gpaui/media-orientation.c,
> +	libgnomeprintui/gpaui/printer-selector.c,
> +	libgnomeprintui/gpaui/settings-selector.c,
> +	libgnomeprintui/gpaui/transport-selector.c
> +	Fixed includes.
> +
> diff -ruN libgnomeprintui/libgnomeprintui/Makefile.am libgnomeprintui-test/libgnomeprintui/Makefile.am
> --- libgnomeprintui/libgnomeprintui/Makefile.am	Thu Mar 28 20:25:00 2002
> +++ libgnomeprintui-test/libgnomeprintui/Makefile.am	Wed Apr 24 16:46:48 2002
> @@ -21,7 +21,7 @@
>  	$(LIBGNOMEPRINTUI_LIBS)
>  
>  libgnomeprintui_2_la_SOURCES = \
> -	gnome-print-i18n.h \
> +	gnome-print-i18n.c gnome-print-i18n.h \
>  	gnome-print-preview.c gnome-print-preview-private.h \
>  	gnome-canvas-hacktext.c gnome-canvas-hacktext.h \
>  	gnome-print-master-preview.c \
> diff -ruN libgnomeprintui/libgnomeprintui/gnome-print-i18n.c libgnomeprintui-test/libgnomeprintui/gnome-print-i18n.c
> --- libgnomeprintui/libgnomeprintui/gnome-print-i18n.c	Thu Jan  1 01:00:00 1970
> +++ libgnomeprintui-test/libgnomeprintui/gnome-print-i18n.c	Wed Apr 24 16:47:10 2002
> @@ -0,0 +1,16 @@
> +#include <config.h>
> +#include "gnome-print-i18n.h"
> +
> +char *
> +libgnomeprint_gettext (const char *msgid)
> +{
> +	static gboolean initialized = FALSE;
> +
> +	if (!initialized) {
> +		bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
> +		bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
> +		initialized = TRUE;
> +	}        
> +
> +	return dgettext (GETTEXT_PACKAGE, msgid);
> +}
> diff -ruN libgnomeprintui/libgnomeprintui/gnome-print-i18n.h libgnomeprintui-test/libgnomeprintui/gnome-print-i18n.h
> --- libgnomeprintui/libgnomeprintui/gnome-print-i18n.h	Mon Feb 15 00:35:29 1999
> +++ libgnomeprintui-test/libgnomeprintui/gnome-print-i18n.h	Wed Apr 24 16:46:48 2002
> @@ -5,26 +5,17 @@
>   *
>   */
>  
> +#ifndef __GNOME_PRINT_I18N_H__
> +#define __GNOME_PRINT_I18N_H__
> +
> +#include <bonobo/bonobo-i18n.h>
> +
>  #ifdef ENABLE_NLS
> -#    include <libintl.h>
>  #    undef _
> -#    define _(String) dgettext (PACKAGE, String)
> -#    ifdef gettext_noop
> -#        define N_(String) gettext_noop (String)
> -#    else
> -#        define N_(String) (String)
> -#    endif
> -#else
> -/* Stubs that do something close enough.  */
> -#    define textdomain(String) (String)
> -#    define gettext(String) (String)
> -#    define dgettext(Domain,Message) (Message)
> -#    define dcgettext(Domain,Message,Type) (Message)
> -#    define bindtextdomain(Domain,Directory) (Domain)
> -#    define _(String) (String)
> -#    define N_(String) (String)
> +#    define _(String)  libgnomeprint_gettext (String)
>  #endif
>  
> -/* This is to let the code in gnome-print blindly include gnome.h */
> -#define __GNOME_I18N_H__
> +char *libgnomeprint_gettext (const char *msgid);
> +
> +#endif /* __GNOME_PRINT_I18N_H__ */
>  
> diff -ruN libgnomeprintui/libgnomeprintui/gnome-font-dialog.c libgnomeprintui-test/libgnomeprintui/gnome-font-dialog.c
> --- libgnomeprintui/libgnomeprintui/gnome-font-dialog.c	Fri Apr 19 23:47:56 2002
> +++ libgnomeprintui-test/libgnomeprintui/gnome-font-dialog.c	Wed Apr 24 16:46:48 2002
> @@ -24,9 +24,7 @@
>   *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>   */
>  
> -#ifdef HAVE_CONFIG_H
>  #include <config.h>
> -#endif
>  
>  #include <string.h>
>  #include <stdlib.h>
> diff -ruN libgnomeprintui/libgnomeprintui/gnome-print-copies.c libgnomeprintui-test/libgnomeprintui/gnome-print-copies.c
> --- libgnomeprintui/libgnomeprintui/gnome-print-copies.c	Fri Apr 19 23:47:56 2002
> +++ libgnomeprintui-test/libgnomeprintui/gnome-print-copies.c	Wed Apr 24 16:46:48 2002
> @@ -24,9 +24,7 @@
>  
>  /* Must include these two first */
>  
> -#ifdef HAVE_CONFIG_H
>  #include <config.h>
> -#endif
>  
>  #include <atk/atkobject.h>
>  #include <atk/atkimage.h>
> diff -ruN libgnomeprintui/libgnomeprintui/gnome-print-dialog.c libgnomeprintui-test/libgnomeprintui/gnome-print-dialog.c
> --- libgnomeprintui/libgnomeprintui/gnome-print-dialog.c	Fri Apr 19 23:47:56 2002
> +++ libgnomeprintui-test/libgnomeprintui/gnome-print-dialog.c	Wed Apr 24 16:46:48 2002
> @@ -25,11 +25,7 @@
>   *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>   */
>  
> -#ifdef HAVE_CONFIG_H
>  #include <config.h>
> -#endif
> -
> -#include "gnome-print-i18n.h"
>  
>  #include <time.h>
>  #include <atk/atkobject.h>
> @@ -50,6 +46,7 @@
>  
>  #include <libgnomeprint/gnome-print-config.h>
>  
> +#include "gnome-print-i18n.h"
>  #include "gnome-printer-dialog.h"
>  #include "gnome-print-paper-selector.h"
>  #include "gnome-print-copies.h"
> diff -ruN libgnomeprintui/libgnomeprintui/gnome-print-master-preview.c libgnomeprintui-test/libgnomeprintui/gnome-print-master-preview.c
> --- libgnomeprintui/libgnomeprintui/gnome-print-master-preview.c	Fri Apr 19 23:47:56 2002
> +++ libgnomeprintui-test/libgnomeprintui/gnome-print-master-preview.c	Wed Apr 24 16:46:48 2002
> @@ -28,9 +28,7 @@
>  
>  #define noGPMP_VERBOSE
>  
> -#ifdef HAVE_CONFIG_H
>  #include <config.h>
> -#endif
>  
>  #include <math.h>
>  #include <libart_lgpl/art_affine.h>
> @@ -51,7 +49,6 @@
>  #include <libgnomeprint/gnome-print-meta.h>
>  
>  #include "gnome-print-i18n.h"
> -
>  #include "gnome-print-master-preview.h"
>  #if 0
>  #include "gnome-print-preview-icons.h"
> diff -ruN libgnomeprintui/libgnomeprintui/gnome-print-paper-selector.c libgnomeprintui-test/libgnomeprintui/gnome-print-paper-selector.c
> --- libgnomeprintui/libgnomeprintui/gnome-print-paper-selector.c	Fri Apr 19 23:47:56 2002
> +++ libgnomeprintui-test/libgnomeprintui/gnome-print-paper-selector.c	Wed Apr 24 16:46:48 2002
> @@ -23,9 +23,7 @@
>   * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
>   */
>  
> -#ifdef HAVE_CONFIG_H
>  #include <config.h>
> -#endif
>  
>  #include <math.h>
>  #include <libart_lgpl/art_misc.h>
> diff -ruN libgnomeprintui/libgnomeprintui/gnome-printer-dialog.c libgnomeprintui-test/libgnomeprintui/gnome-printer-dialog.c
> --- libgnomeprintui/libgnomeprintui/gnome-printer-dialog.c	Fri Apr 19 23:47:56 2002
> +++ libgnomeprintui-test/libgnomeprintui/gnome-printer-dialog.c	Wed Apr 24 16:46:48 2002
> @@ -26,9 +26,7 @@
>   *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>   */
>  
> -#ifdef HAVE_CONFIG_H
>  #include <config.h>
> -#endif
>  
>  #include <atk/atkobject.h>
>  #include <atk/atkrelationset.h>
> diff -ruN libgnomeprintui/libgnomeprintui/gpaui/add-printer-dialog.c libgnomeprintui-test/libgnomeprintui/gpaui/add-printer-dialog.c
> --- libgnomeprintui/libgnomeprintui/gpaui/add-printer-dialog.c	Mon Oct 29 06:49:07 2001
> +++ libgnomeprintui-test/libgnomeprintui/gpaui/add-printer-dialog.c	Wed Apr 24 16:46:48 2002
> @@ -13,6 +13,8 @@
>   *
>   */
>  
> +#include <config.h>
> +
>  #include <gtk/gtksignal.h>
>  #include <gtk/gtkclist.h>
>  #include <gtk/gtkcontainer.h>
> @@ -25,6 +27,7 @@
>  #include <gtk/gtktable.h>
>  #include <libgpa/gpa-printer.h>
>  #include "add-printer-dialog.h"
> +#include "../gnome-print-i18n.h"
>  
>  #define PADDING 2
>  
> diff -ruN libgnomeprintui/libgnomeprintui/gpaui/config-dialog.c libgnomeprintui-test/libgnomeprintui/gpaui/config-dialog.c
> --- libgnomeprintui/libgnomeprintui/gpaui/config-dialog.c	Mon Oct 29 06:49:07 2001
> +++ libgnomeprintui-test/libgnomeprintui/gpaui/config-dialog.c	Wed Apr 24 16:46:48 2002
> @@ -13,7 +13,8 @@
>   *
>   */
>  
> -#include <libgnomeprint/gnome-print-i18n.h>
> +#include <config.h>
> +
>  #include <gtk/gtksignal.h>
>  #include <gtk/gtkclist.h>
>  #include <gtk/gtkcontainer.h>
> @@ -25,6 +26,7 @@
>  #include <gtk/gtkscrolledwindow.h>
>  #include <gtk/gtktable.h>
>  #include "add-printer-dialog.h"
> +#include "../gnome-print-i18n.h"
>  
>  #define PADDING 2
>  
> diff -ruN libgnomeprintui/libgnomeprintui/gpaui/media-orientation.c libgnomeprintui-test/libgnomeprintui/gpaui/media-orientation.c
> --- libgnomeprintui/libgnomeprintui/gpaui/media-orientation.c	Wed Dec 19 03:25:39 2001
> +++ libgnomeprintui-test/libgnomeprintui/gpaui/media-orientation.c	Wed Apr 24 16:46:48 2002
> @@ -12,6 +12,8 @@
>   *
>   */
>  
> +#include <config.h>
> +
>  #include <string.h>
>  #include <gtk/gtksignal.h>
>  #include <gtk/gtkcheckbutton.h>
> diff -ruN libgnomeprintui/libgnomeprintui/gpaui/printer-selector.c libgnomeprintui-test/libgnomeprintui/gpaui/printer-selector.c
> --- libgnomeprintui/libgnomeprintui/gpaui/printer-selector.c	Fri Dec 14 05:22:27 2001
> +++ libgnomeprintui-test/libgnomeprintui/gpaui/printer-selector.c	Wed Apr 24 16:46:48 2002
> @@ -12,6 +12,8 @@
>   *
>   */
>  
> +#include <config.h>
> +
>  #include <string.h>
>  #include <gtk/gtksignal.h>
>  #include <gtk/gtkmenu.h>
> diff -ruN libgnomeprintui/libgnomeprintui/gpaui/settings-selector.c libgnomeprintui-test/libgnomeprintui/gpaui/settings-selector.c
> --- libgnomeprintui/libgnomeprintui/gpaui/settings-selector.c	Wed Dec 19 03:25:39 2001
> +++ libgnomeprintui-test/libgnomeprintui/gpaui/settings-selector.c	Wed Apr 24 16:46:48 2002
> @@ -21,6 +21,8 @@
>   *
>   */
>  
> +#include <config.h>
> +
>  #include <gtk/gtksignal.h>
>  #include <gtk/gtkmenu.h>
>  #include <gtk/gtkmenuitem.h>
> diff -ruN libgnomeprintui/libgnomeprintui/gpaui/transport-selector.c libgnomeprintui-test/libgnomeprintui/gpaui/transport-selector.c
> --- libgnomeprintui/libgnomeprintui/gpaui/transport-selector.c	Wed Dec 19 03:25:39 2001
> +++ libgnomeprintui-test/libgnomeprintui/gpaui/transport-selector.c	Wed Apr 24 16:46:48 2002
> @@ -12,6 +12,8 @@
>   *
>   */
>  
> +#include <config.h>
> +
>  #include <string.h>
>  #include <gtk/gtksignal.h>
>  #include <gtk/gtkhbox.h>
> ----
> 

> diff -ruNp gal/ChangeLog gal-test/ChangeLog
> --- gal/ChangeLog	Mon Apr 15 17:12:08 2002
> +++ gal-test/ChangeLog	Wed Apr 24 18:30:20 2002
> @@ -0,0 +1,38 @@
> +2002-04-24  Zbigniew Chyla  <cyba gnome pl>
> +
> +	i18n fixes
> +
> +	* gal/Makefile.am (libgal_2_0_la_LIBADD):
> +	Removed util/e-unicode-i18n.lo.
> +
> +	* configure.in: Fixed GETTEXT_PACKAGE.
> +
> +	* gal/e-table/e-table-group-container.c (compute_text):
> +	s/U_/_/
> +
> +	* gal/util/Makefile.am
> +	(libutil_la_SOURCES): Removed e-unicode-i18n.[ch],
> +	(libgalinclude_HEADERS): Moved e-i18n.h to libutil_la_SOURCES,
> +	(INCLUDES): Define GNOMELOCALEDIR.
> +
> +	* gal/util/e-util.c:
> +	Added e_gettext().
> +
> +	* gal/util/e-i18n.h:
> +	Removed #defines cut&pasted from gnome-i18n.h/bonobo-i18n.h,
> +	included <bonobo/bonobo-i18n.h> and defined _() macro as
> +	e_gettext() function call.
> +
> +	* gal/widgets/e-categories-master-list-array.c (ecmla_default):
> +	Don't use e_utf8_from_locale_string.
> +
> +	* gal/e-table/e-cell-text.c,
> +	gal/e-table/e-table-config-field.c,
> +	gal/e-table/e-table-item.c,
> +	gal/e-table/e-tree.c,
> +	gal/e-text/e-entry-test.c,
> +	gal/widgets/e-categories.c,
> +	gal/widgets/e-popup-menu.c,
> +	gal/widgets/test-color.c:
> +	Fixed includes.
> +
> diff -ruNp gal/configure.in gal-test/configure.in
> --- gal/configure.in	Mon Apr 15 17:12:08 2002
> +++ gal-test/configure.in	Wed Apr 24 18:30:20 2002
> @@ -63,7 +63,7 @@ AC_SUBST(CPPFLAGS)
>  AC_SUBST(LDFLAGS)
>  
>  ALL_LINGUAS="az ca cs da de el en_GB es eu fi fr gl hu it ja ko lt ms nn no pl pt pt_BR ro ru sk sv ta tr uk zh_CN zh_TW"
> -GETTEXT_PACKAGE=$(GAL_EPOCH)
> +GETTEXT_PACKAGE=${GAL_EPOCH}
>  AC_SUBST(GETTEXT_PACKAGE)
>  AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE")
>  AM_GLIB_GNU_GETTEXT
> diff -ruNp gal/gal/Makefile.am gal-test/gal/Makefile.am
> --- gal/gal/Makefile.am	Fri Feb  8 22:57:48 2002
> +++ gal-test/gal/Makefile.am	Wed Apr 24 18:30:20 2002
> @@ -20,7 +20,6 @@ libgal_2_0_la_LIBADD = \
>  	util/e-sorter.lo				\
>  	util/e-text-event-processor-emacs-like.lo	\
>  	util/e-text-event-processor.lo			\
> -	util/e-unicode-i18n.lo				\
>  	util/e-util.lo					\
>  	util/e-xml-utils.lo				\
>  	\
> diff -ruNp gal/gal/e-table/e-cell-text.c gal-test/gal/e-table/e-cell-text.c
> --- gal/gal/e-table/e-cell-text.c	Fri Feb  8 22:57:50 2002
> +++ gal-test/gal/e-table/e-cell-text.c	Wed Apr 24 18:30:20 2002
> @@ -53,6 +53,7 @@
>  #include "gal/util/e-text-event-processor.h"
>  #include "gal/e-text/e-text.h"
>  #include "gal/util/e-text-event-processor-emacs-like.h"
> +#include "gal/util/e-i18n.h"
>  #include "e-table-tooltip.h"
>  
>  #define d(x)
> diff -ruNp gal/gal/e-table/e-table-config-field.c gal-test/gal/e-table/e-table-config-field.c
> --- gal/gal/e-table/e-table-config-field.c	Fri Feb  8 22:57:50 2002
> +++ gal-test/gal/e-table/e-table-config-field.c	Wed Apr 24 18:30:20 2002
> @@ -26,6 +26,7 @@
>  #include <gtk/gtk.h>
>  #include <gtk/gtkbox.h>
>  #include "gal/util/e-util.h"
> +#include "gal/util/e-i18n.h"
>  #include "e-table-config-field.h"
>  
>  #define PARENT_TYPE (gtk_vbox_get_type())
> diff -ruNp gal/gal/e-table/e-table-group-container.c gal-test/gal/e-table/e-table-group-container.c
> --- gal/gal/e-table/e-table-group-container.c	Fri Feb  8 22:57:51 2002
> +++ gal-test/gal/e-table/e-table-group-container.c	Wed Apr 24 18:30:20 2002
> @@ -352,14 +352,14 @@ compute_text (ETableGroupContainer *etgc
>  
>  	if (etgc->ecol->text) {
>  		text = g_strdup_printf ((child_node->count == 1)
> -					? U_("%s : %s (%d item)")
> -					: U_("%s : %s (%d items)"),
> +					? _("%s : %s (%d item)")
> +					: _("%s : %s (%d items)"),
>  					etgc->ecol->text, child_node->string,
>  					(gint) child_node->count);
>  	} else {
>  		text = g_strdup_printf ((child_node->count == 1)
> -					? U_("%s (%d item)")
> -					: U_("%s (%d items)"),
> +					? _("%s (%d item)")
> +					: _("%s (%d items)"),
>  					child_node->string,
>  					(gint) child_node->count);
>  	}
> diff -ruNp gal/gal/e-table/e-table-item.c gal-test/gal/e-table/e-table-item.c
> --- gal/gal/e-table/e-table-item.c	Fri Feb  8 22:57:51 2002
> +++ gal-test/gal/e-table/e-table-item.c	Wed Apr 24 18:30:20 2002
> @@ -41,6 +41,7 @@
>  #include "gal/widgets/e-canvas.h"
>  #include "gal/widgets/e-canvas-utils.h"
>  #include "gal/util/e-util.h"
> +#include "gal/util/e-i18n.h"
>  #include <string.h>
>  #include <stdlib.h>
>  
> diff -ruNp gal/gal/e-table/e-tree.c gal-test/gal/e-table/e-tree.c
> --- gal/gal/e-table/e-tree.c	Sun Feb 17 17:01:22 2002
> +++ gal-test/gal/e-table/e-tree.c	Wed Apr 24 18:30:20 2002
> @@ -30,7 +30,7 @@
>  #include <gtk/gtksignal.h>
>  #include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
>  
> -#include "gal/util/e-i18n.h"
> +#include <gal/util/e-i18n.h>
>  #include <gal/util/e-util.h>
>  #include <gal/widgets/e-canvas.h>
>  
> diff -ruNp gal/gal/e-text/e-entry-test.c gal-test/gal/e-text/e-entry-test.c
> --- gal/gal/e-text/e-entry-test.c	Fri Feb  8 22:57:59 2002
> +++ gal-test/gal/e-text/e-entry-test.c	Wed Apr 24 18:30:20 2002
> @@ -21,10 +21,11 @@
>   * 02111-1307, USA.
>   */
>  
> -#include "config.h"
> +#include <config.h>
>  
>  #include <gnome.h>
>  #include "e-entry.h"
> +#include <gal/util/e-i18n.h>
>  
>  static void destroy_callback(GtkWidget *app, gpointer data)
>  {
> diff -ruNp gal/gal/util/Makefile.am gal-test/gal/util/Makefile.am
> --- gal/gal/util/Makefile.am	Fri Feb  8 22:58:14 2002
> +++ gal-test/gal/util/Makefile.am	Wed Apr 24 18:30:20 2002
> @@ -3,7 +3,8 @@ INCLUDES =					\
>  	$(GNOME_INCLUDEDIR)			\
>  	$(ICONV_CFLAGS)				\
>  	-I$(top_srcdir)                         \
> -        -DG_LOG_DOMAIN=\"widgets\"
> +	-DG_LOG_DOMAIN=\"widgets\"		\
> +	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"
>  
>  noinst_LTLIBRARIES = libutil.la
>  
> @@ -13,14 +14,13 @@ noinst_LTLIBRARIES = libutil.la
>  libutil_la_SOURCES =	\
>  	e-bit-array.c	\
>  	e-cache.c	\
> +	e-i18n.h	\
>  	e-iconv.h	\
>  	e-iconv.c	\
>  	e-sorter-array.c	\
>  	e-sorter.c	\
>  	e-text-event-processor-emacs-like.c	\
>  	e-text-event-processor.c		\
> -	e-unicode-i18n.c	\
> -	e-unicode-i18n.h	\
>  	e-util.c	\
>  	e-xml-utils.c
>  
> @@ -30,7 +30,6 @@ libgalincludedir = $(includedir)/$(GAL_E
>  libgalinclude_HEADERS =	\
>  	e-bit-array.h	\
>  	e-cache.h	\
> -	e-i18n.h	\
>  	e-marshal.h	\
>  	e-sorter-array.h	\
>  	e-sorter.h	\
> diff -ruNp gal/gal/util/e-i18n.h gal-test/gal/util/e-i18n.h
> --- gal/gal/util/e-i18n.h	Fri Feb  8 22:58:14 2002
> +++ gal-test/gal/util/e-i18n.h	Wed Apr 24 18:30:20 2002
> @@ -35,48 +35,16 @@
>  #ifndef __E_I18N_H__
>  #define __E_I18N_H__
>  
> -#include <glib.h>
> +#include <bonobo/bonobo-i18n.h>
>  
>  G_BEGIN_DECLS
>  
>  #ifdef ENABLE_NLS
> -#    include <libintl.h>
> +	/* this function is defined in e-util.c */
> +	extern char *e_gettext (const char *msgid);
>  #    undef _
> -#    define _(String) dgettext (PACKAGE, String)
> -#    ifdef gettext_noop
> -#        define N_(String) gettext_noop (String)
> -#    else
> -#        define N_(String) (String)
> -#    endif
> -#else
> -/* Stubs that do something close enough.  */
> -#    define textdomain(String) (String)
> -#    define gettext(String) (String)
> -#    define dgettext(Domain,Message) (Message)
> -#    define dcgettext(Domain,Message,Type) (Message)
> -#    define bindtextdomain(Domain,Directory) (Domain)
> -#    define _(String) (String)
> -#    define N_(String) (String)
> +#    define _(String)  e_gettext (String)
>  #endif
> -
> -/*
> - * Do not remove the following define, nor do surround it with ifdefs.
> - *
> - * If you get any `redefined' errors, it means that you are including
> - * -incorrectly- a header file provided by gnome-libs before this file.
> - * To correctly solve this issue include this file before any libgnome/
> - * libgnomeui headers
> - */
> -
> -#define __GNOME_I18N_H__ 1
> -
> -
> -/* This is copied staight out of the prototypes for gnome-i18n.h */
> -const char *gnome_i18n_get_language(void);
> -GList      *gnome_i18n_get_language_list (const gchar *category_name);
> -void	   gnome_i18n_set_preferred_language (const char *val);
> -const char *gnome_i18n_get_preferred_language (void);
> -void gnome_i18n_init (void);
>  
>  G_END_DECLS
>  
> diff -ruNp gal/gal/util/e-util.c gal-test/gal/util/e-util.c
> --- gal/gal/util/e-util.c	Fri Feb  8 22:58:14 2002
> +++ gal-test/gal/util/e-util.c	Wed Apr 24 18:30:20 2002
> @@ -23,6 +23,7 @@
>  
>  #include <config.h>
>  #include "e-util.h"
> +#include "e-i18n.h"
>  
>  #include <glib.h>
>  #include <gtk/gtkobject.h>
> @@ -1050,4 +1051,18 @@ e_strdup_append_strings (gchar *first_st
>  	va_end (args2);
>  
>  	return buffer;
> +}
> +
> +char *
> +e_gettext (const char *msgid)
> +{
> +	static gboolean initialized = FALSE;
> +
> +	if (!initialized) {
> +		bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
> +		bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
> +		initialized = TRUE;
> +	}        
> +
> +	return dgettext (GETTEXT_PACKAGE, msgid);
>  }
> diff -ruNp gal/gal/widgets/e-categories-master-list-array.c gal-test/gal/widgets/e-categories-master-list-array.c
> --- gal/gal/widgets/e-categories-master-list-array.c	Fri Feb  8 22:58:16 2002
> +++ gal-test/gal/widgets/e-categories-master-list-array.c	Wed Apr 24 18:30:20 2002
> @@ -301,9 +301,8 @@ ecmla_default (ECategoriesMasterListArra
>  	ecmla->priv->categories = g_new (ECategoriesMasterListArrayItem *, BUILTIN_CATEGORY_COUNT);
>  
>  	for (i = 0; i < BUILTIN_CATEGORY_COUNT; i++) {
> -		char *category = e_utf8_from_locale_string(_(builtin_categories[i].category));
> +		char *category = _(builtin_categories[i].category);
>  		ecmla->priv->categories[i] = ecmlai_new (category, builtin_categories[i].icon, NULL);
> -		g_free (category);
>  	}
>  }
>  
> diff -ruNp gal/gal/widgets/e-categories.c gal-test/gal/widgets/e-categories.c
> --- gal/gal/widgets/e-categories.c	Fri Feb  8 22:58:16 2002
> +++ gal-test/gal/widgets/e-categories.c	Wed Apr 24 18:30:20 2002
> @@ -25,7 +25,6 @@
>  #include <gtk/gtk.h>
>  #include "e-categories.h"
>  
> -#include "gal/util/e-i18n.h"
>  #include <string.h>
>  #include <gdk/gdkkeysyms.h>
>  
> diff -ruNp gal/gal/widgets/e-popup-menu.c gal-test/gal/widgets/e-popup-menu.c
> --- gal/gal/widgets/e-popup-menu.c	Fri Feb  8 22:58:16 2002
> +++ gal-test/gal/widgets/e-popup-menu.c	Wed Apr 24 18:30:20 2002
> @@ -32,7 +32,7 @@
>  #include "e-popup-menu.h"
>  #include "e-gui-utils.h"
>  
> -#include <libgnome/gnome-i18n.h>
> +#include <gal/util/e-i18n.h>
>  
>  #ifndef GNOME_APP_HELPER_H
>  /* Copied this i18n function to use for the same purpose */
> diff -ruNp gal/gal/widgets/test-color.c gal-test/gal/widgets/test-color.c
> --- gal/gal/widgets/test-color.c	Fri Feb 15 06:41:22 2002
> +++ gal-test/gal/widgets/test-color.c	Wed Apr 24 18:30:20 2002
> @@ -20,6 +20,8 @@
>   * 02111-1307, USA.
>   */
>  
> +#include <config.h>
> +#include <gal/util/e-i18n.h>
>  #include <gnome.h>
>  #include "widget-color-combo.h"
>  #include "color-palette.h"
> diff -ruNp gal/tests/test-table-1.c gal-test/tests/test-table-1.c
> --- gal/tests/test-table-1.c	Sun Feb 17 17:30:44 2002
> +++ gal-test/tests/test-table-1.c	Wed Apr 24 18:30:20 2002
> @@ -28,8 +28,8 @@
>  #include "gal/widgets/e-cursors.h"
>  #include "gal/e-table/e-table-simple.h"
>  #include "gal/e-table/e-table.h"
> +#include "gal/util/e-i18n.h"
>  
> -#include <libgnome/gnome-i18n.h>
>  #include <libgnomeui/libgnomeui.h>
>  
>  /*
-- 
Carlos Perelló Marín
mailto:carlos gnome-db org
mailto:carlos perello hispalinux es
http://www.gnome-db.org
http://www.Hispalinux.es
Valencia - Spain

Attachment: signature.asc
Description: Esta parte del mensaje esta firmada digitalmente



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