Re: [linux-audio-dev] [ANN] VLevel 0.5

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] [ANN] VLevel 0.5
From: Steve Harris (S.W.Harris_AT_ecs.soton.ac.uk)
Date: Mon Jul 07 2003 - 13:39:25 EEST


On Mon, Jul 07, 2003 at 11:50:00AM +0200, Alfons Adriaensen wrote:
> As to internationalisation, I received a request some time ago to
> integrate gettext support in the moogvcf plugins. Thinking about
> this, my conclusion was that the code required to do this should not
> be in each and every plugin, but in the host - the plugin would only
> supply the keys enabling the host to lookup the translated texts.
> The ideal solution for me would be to make the plugin provide both
> the default text, and (optionally) in a second array, the lookup keys.

The standard gettext methods work perfectly well in plugins, so all you
have to do is replace the calls to strdup() with a macro (and
provide .po files) and the plugin will use the i18n information from
the environment in any host.

My init function looks like:

__init() {
        ...

#ifdef ENABLE_NLS
#define D_(s) dgettext(PACKAGE, s)
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR);
#else
#define D_(s) (s)
#endif

        ...
}

I've been shipping plugins like this for a while, but I only have C and
en_GB locales so its not very obvious :)

- Steve


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Jul 07 2003 - 13:42:09 EEST