Re: glibintl / gutils.c issues ...
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Subject: Re: glibintl / gutils.c issues ...
- Date: 18 Apr 2001 17:40:27 -0400
Michael Meeks <michael ximian com> writes:
> Three things if I may,
>
> Firstly, why is glibintl.h not installed, or at least - an
> equivalent to it - it is generaly useful, and curently something I'm
> having to replicate in several modules ( replacing gnome-i18n.h's
Because the use of gettext is an internal implementation detail
of GLib, not something we advertise to the world, I think it
would be a little funny to ship an extra header just for use with
gettext.
Also, you end up with some more complex dependencies, like having
a special #define for the domain name, and so forth.
> why does glibintl.h define _() to always use the internal
> _glib_gettext function ? surely this can be done less expensively with a
> simple macro -> dgettext for all non-windows platforms.
Because there is no g_init(). Note that the only use of translated
strings in GLib is for error messages, so a few extra function
calls are not going to matter much. (And code size is actually
reduced by not doing the funkey gettext macro stuff.)
> Lastly:
>
> have I lost my mind when I read:
>
> G_CONST_RETURN gchar *
> _glib_gettext (const gchar *str)
> {
> gboolean _glib_gettext_initialized = FALSE;
>
> if (!_glib_gettext_initialized)
>
> {
> bindtextdomain(GETTEXT_PACKAGE, GLIB_LOCALE_DIR);
> _glib_gettext_initialized = TRUE;
> }
>
> return dgettext (GETTEXT_PACKAGE, str);
> }
>
> Looks like we're missing a 'static' on that ( strangely '_'
> prefixed, but localy scoped ) boolean, and this constantly calling
> bindtextdomain per invocation.
Yep, fixed, thanks. We use _glib,_gtk for non-static but non-exported
functions in 2.0.
> Also, why are we paying a per string cost on a 1 off
> initialization routine ? does glib not have some _init function in which
> the bindtextdomain can be performed once for all ?
No, it doesn't.
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]