<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Nick.<br>
<br>
Nick Treleaven wrote:
<blockquote
cite="mid:20090903114358.4be6b0db.nick.treleaven@btinternet.com"
type="cite">
<pre wrap="">On Thu, 03 Sep 2009 12:10:21 +0400
Eugene Arshinov <a class="moz-txt-link-rfc2396E"
href="mailto:earshinov@gmail.com"><earshinov@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">The trouble: in plugin manager plugin name (and also its description) is
not localized until plugin is activated. The cause (probably):
main_locale_init(LOCALEDIR, GETTEXT_PACKAGE) is called only in
plugin_init(), and plugin_set_info() is obviously called before that.
</pre>
</blockquote>
<pre wrap=""><!---->...
</pre>
<blockquote type="cite">
<pre wrap="">I see two ways to fix this problem. The first way is very ugly and
limitating: just call main_locale_init() from plugin_set_info(), and
recompile all
plugins. The second way is to add new function to be implemented in
plugins (say, "plugin_loaded") and call that before anything else
(particularly, before plugin_set_info()).
So, the question is how to solve this problem.
</pre>
</blockquote>
<pre wrap=""><!---->
I would prefer calling main_locale_init() from plugin_set_info(),
but would that have much of a performance impact for the plugin
manager dialog? I guess it's probably necessary though.
</pre>
</blockquote>
<br>
It's hard to guess for me whether the slowdown would be large. I tried
to measure execution time of main_locale_init() in addons plugin, but
it returned 0 msec…<br>
<br>
clock_t t = clock();<br>
main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);<br>
g_debug("Function main_locale_init() took %f msec.",<br>
(double)(clock() - t) * 1000 / CLOCKS_PER_SEC);<br>
<br>
<blockquote
cite="mid:20090903114358.4be6b0db.nick.treleaven@btinternet.com"
type="cite">
<pre wrap="">The other question is how to implement this with the PLUGIN_SET_INFO
macro so main_locale_init() is called correctly (and only when
necessary?) for all plugins.
</pre>
</blockquote>
<br>
Function plugin_set_info() is called exactly once after a plugin is
loaded. Function main_locale_init() should be called at least once (the
less calls the better) after a plugin is loaded, as far as I understand
what this call does (I had very little experience with gettext). So why
not just put a single call into PLUGIN_SET_INFO?<br>
<br>
void plugin_set_info(PluginInfo* info) \<br>
{ \<br>
main_locale_init(LOCALEDIR, GETTEXT_PACKAGE); \<br>
info->name = (p_name); \<br>
info->description = (p_description); \<br>
info->version = (p_version); \<br>
info->author = (p_author); \<br>
}<br>
<br>
Best regards,<br>
Eugene.<br>
</body>
</html>