From: Hans U. N. <gp...@n-...> - 2005-05-02 18:37:17
|
Lutz M=C3=BCller <lu...@us...> writes: > On Mon, 2005-05-02 at 13:37 +0200, Hans Ulrich Niedermann wrote: >> This will make libexif return all strings in UTF-8 regardless of the >> current locale. >> This would mean that we should add an additional function to libexif >> which allows such libexif users (libexif-gtk, gexif, or any other >> software which requires UTF-8) to explicitly request UTF-8. >> Is this correct? > > There are lots of functions that return translated strings. Wouldn't it > be easier to remove the calls to "bind_textdomain_codeset" and leave the > task of calling this function to the frontends? Then libexif must tell the frontend the gettext domain libexif uses, which IMHO isn't the frontend's business. I'd like to propose this (if it makes sense): /**(exported function) * Explicitly set the codeset for translated libexif messages. * * @codeset The character set to use. "UTF-8" is guaranteed to work. * @returns The return value of bind_textdomain_codeset(3) * * Constraints: * - Requires a gettext supporting bind_textdomain_codeset() * - Must be called before all other libexif functions **/ =20 const char *exif_set_message_codeset(const char *codeset) { const char *result =3D #ifdef HAVE_BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset(GETTEXT_DOMAIN, codeset); #else (const char *) NULL; #endif exif_init_gettext(); return result; } /**(libexif internal function) * Initialize the message translation system. * * @returns The return value of bindtextdomain(3) * * This function must be called by an exported libexif function * before any libexif function translates any messages. **/ const char *exif_init_gettext(void) { static char *basedir =3D NULL; if (basedir =3D=3D NULL) { initialized =3D 1; basedir =3D bindtextdomain(GETTEXT_DOMAIN, LOCALEDIR); } return basedir; } |