Hi there,
this is a patch against the lxpanel-0.8.0.tar.xz tarball.
This patch allows plugin developers to define an optional value for GETTEXT_PACKAGE in the LXPanelPluginInit struct.
Why is this useful?
This makes it possible to package plugin binaries and their gettext translations outside of the lxpanel distribution package.
See discussion in [1].
What is the problem being solved?
Currently, the plugin "name" and "description" are translated through gettext _() calls from within lxpanel itself.
The unwanted side effect is that the gettext call will then use the GETTEXT_PACKAGE "lxpanel" and look for translated strings in /usr/share/locale/<LOCALE>/LC_MESSAGES/lxpanel.mo
This requires all translations to reside in lxpanel.po. Or in other words, only lxpanel plugins that are part of the lxpanel tarball can offer translated messages.
Attached is a modified example plugin, based on [2].
Note that it doesn't use gi18n.h as described in [2], but
#define GETTEXT_PACKAGE "lxpanel-testplugin" #include <glib/gi18n-lib.h>
instead and then finally sets the corresponding value in the plugin descriptor:
/* Plugin descriptor. */ LXPanelPluginInit fm_module_init_lxpanel_gtk = { .name = N_("TestPlugin"), .description = N_("Run a test plugin."), .gettext_package = GETTEXT_PACKAGE, .new_instance = test_constructor };
As a result, if this variable is set, all gettext calls in lxpanel will use this gettext package and translation strings are being found.
[1] http://sourceforge.net/p/lxde/mailman/lxde-i18n/thread/54CA35AD.5000600%40hanno.de/
[2] http://wiki.lxde.org/en/How_to_write_plugins_for_LXPanel
Bump.
Requesting a brief review of / an opinion about this patch.
Thanks!
Thank you very much. Accepted your patch into LXPanel sources, with some changes, that were required.