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