[Geany-devel] About translation of plugin name and description

Enrico Tröger enrico.troeger at xxxxx
Mon May 10 17:55:10 UTC 2010

On Mon, 10 May 2010 00:12:47 +0200 (CEST), Colomban wrote:

> Hi,
> I just wondered why my plugin's name and description wasn't translated
> since every other part of my plugin was. But a little thinking made me
> realize it's completely "normal": of course bindtextdomain() wasn't
> already called for my plugin when plugin_set_info() is called, which
> explains it all.
> And then, how to solve this? The easy and naive solution would be to
> call main_locale_init() in the top of plugin_set_info(), but it
> doesn't work since geany_functions isn't set at this time. A manual
> call to bindtextdomain() and friends of course solves the problem,
> but we lose the cool things that both main_locale_init() (simplicity,
> consistent Windows support, etc.) and PLUGIN_SET_INFO() brings.
> I think something like PLUGIN_SET_TRANSLATABLE_INFO(localedir,
> package, name, description, version, author) (or any other better
> name) would be a solution: it would call main_locale_init() (or
> manually do the stuff main_locale_init() does) and then set the
> plugin infos. In facts, it would only need to set geany_functions &
> friends /before any/ plugin function call -- even plugin_set_info().
> OTHO, it pollutes a bit gettext's "database" by binding (and perhaps
> loading?) almost useless translation domains -- since the plugin
> might not be loaded -- but it probably can't be avoided if we want
> translations at this point.
> What do you think? Do you see (an)other solution(s) to fix this? Do
> you think it worth it (I definitely think so but still)?

I personally don't think it's strictly necessary, though of course it
would be nice. But then, I personally also use en_GB as locale so I
almost always get the correct string :).
PLUGIN_SET_TRANSLATABLE_INFO is an interesting idea, are you sure that
would work? I didn't test it at all, so I'm just curious. I guess the
former question will make you testing it and once you had enough code
to test it, you probably also will send a patch, I guess :). If so,
cool. If not, also cool.
At least this topic raised a few times (I think to remember at least
two times).
Ah, just found the last discussion:

> PS: Ah, and on a similar topic, why does main_locale_init() call
> textdomain()? I think it is useless (and probably pointless) since it

To be honest: because I found it somewhere else and used it as well.
This happened as one of the first steps of Geany's lifetime long time
ago when I had a lot less experience. And since then, I just didn't
touch the code anymore since it worked :).


Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20100510/84e3ab73/attachment.pgp>

More information about the Devel mailing list