Re: locale data in different prefix



On 6 May 2001, Gediminas Paulauskas wrote:

> Which library? Yes, I can only confirm, that gnome-libs, and bonobo
> work. But both of them do it in bonobo_init or
> gnome_init_with_popt_table, and application must call these
> initialization functions.
>
> However, gal does not gave gal_init function. Should it call
> bindtextdomain before any use of dgettext? Or, it would be a solution,
> can a library have main() function? And where to put it (useing gal as
> example)?

For cases like that, you can use a gettext wrapper similar to what glib
does in the HEAD branch.  That is, defining the _() macro to call a
function something like this:
gchar *
_gal_gettext (const gchar *str)
{
    static gboolean initialised = FALSE;

    if (!initialised) {
        bindtextdomain(PACKAGE, LOCALEDIR);
        initialised = TRUE;
    }
    return dgettext(PACKAGE, str);
}

This will delay the bindtextdomain() call til the first gettext usage in
the library, which gets rid of the need to call it in a library
initialisation function.

James.

-- 
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/






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