glibintl / gutils.c issues ...



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

#ifdef ENABLE_NLS
#    include <libintl.h>
#    ifdef GNOME_EXPLICIT_TRANSLATION_DOMAIN
#        undef _
#        define _(String) dgettext (GNOME_EXPLICIT_TRANSLATION_DOMAIN, String)
#    else 
#        define _(String) gettext (String)
#    endif
#    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)
#endif

	)

	Secondly:

	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.

	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.

	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 ?

	Confusedly,

		Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot





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