RSS/Atom feed Twitter
Site is read-only, email is disabled

problem (solved?) in gimp-plugin-template

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

12 of 12 messages available
Toggle history

Please log in to manage your subscriptions.

problem (solved?) in gimp-plugin-template Carlo Baldassi 06 Nov 09:36
  problem (solved?) in gimp-plugin-template Sven Neumann 06 Nov 10:16
   problem (solved?) in gimp-plugin-template Michael Schumacher 06 Nov 11:26
problem (solved?) in gimp-plugin-template Carlo Baldassi 06 Nov 09:37
problem (solved?) in gimp-plugin-template Carlo Baldassi 10 Nov 05:59
  problem (solved?) in gimp-plugin-template Sven Neumann 10 Nov 16:38
problem (solved?) in gimp-plugin-template Carlo Baldassi 11 Nov 00:23
  problem (solved?) in gimp-plugin-template Sven Neumann 12 Nov 19:43
   problem (solved?) in gimp-plugin-template Michael Schumacher 12 Nov 21:47
problem (solved?) in gimp-plugin-template Carlo Baldassi 12 Nov 22:26
problem (solved?) in gimp-plugin-template Carlo Baldassi 12 Nov 22:49
  problem (solved?) in gimp-plugin-template Sven Neumann 12 Nov 23:19
Carlo Baldassi
2007-11-06 09:36:01 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Hi,

I have developed a GIMP plugin using the plugin template, and I have been made aware of a problem in i18n support, which I think I solved: the plugin name was not translated correctly in the menu.

I think this is due to the fact that i18n is initialized in the run() function, while the plugin name is given in the query() function through a call to gimp_install_procedure().. What I did was just copy-pasting the i18n init code right before the gimp_install_procedure() call, and substituting "N_(...)" with "_(...)", like this:

/* Initialize i18n support */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); #ifdef HAVE_BIND_TEXTDOMAIN_CODESET

bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); #endif
textdomain (GETTEXT_PACKAGE);

gimp_install_procedure (PROCEDURE_NAME, "Blurb",
"Help",
"Michael Natterer ",
"Michael Natterer ",
"2000-2004",
_("Plug-In Template..."), "RGB*, GRAY*, INDEXED*", GIMP_PLUGIN,
G_N_ELEMENTS (args),
0,
args, NULL);

I don't know if the "N_(...)" call was meant to let it work, but in my system "gettex_noop()" is not defined, and "N_(...)" becomes "(...)" (don't know the reason of this). It seems to work well now, but I don't know if this procedure has any drawbacks (e.g. if initializing i18n twice gives any problem) or is incorrect for some reason.

Carlo Baldassi

___________________________________ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html

Carlo Baldassi
2007-11-06 09:37:01 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Hi,

I have developed a GIMP plugin using the plugin template, and I have been made aware of a problem in i18n support, which I think I solved: the plugin name was not translated correctly in the menu.

I think this is due to the fact that i18n is initialized in the run() function, while the plugin name is given in the query() function through a call to gimp_install_procedure().. What I did was just copy-pasting the i18n init code right before the gimp_install_procedure() call, and substituting "N_(...)" with "_(...)", like this:

/* Initialize i18n support */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); #ifdef HAVE_BIND_TEXTDOMAIN_CODESET

bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); #endif
textdomain (GETTEXT_PACKAGE);

gimp_install_procedure (PROCEDURE_NAME, "Blurb",
"Help",
"Michael Natterer ",
"Michael Natterer ",
"2000-2004",
_("Plug-In Template..."), "RGB*, GRAY*, INDEXED*", GIMP_PLUGIN,
G_N_ELEMENTS (args),
0,
args, NULL);

I don't know if the "N_(...)" call was meant to let it work, but in my system "gettex_noop()" is not defined, and "N_(...)" becomes "(...)" (don't know the reason of this). It seems to work well now, but I don't know if this procedure has any drawbacks (e.g. if initializing i18n twice gives any problem) or is incorrect for some reason.

Carlo Baldassi

___________________________________ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html

Sven Neumann
2007-11-06 10:16:01 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Hi,

On Tue, 2007-11-06 at 08:36 +0000, Carlo Baldassi wrote:

I have developed a GIMP plugin using the plugin template, and I have been made aware of a problem in i18n support, which I think I solved: the plugin name was not translated correctly in the menu.

I think this is due to the fact that i18n is initialized in the run() function, while the plugin name is given in the query() function through a call to gimp_install_procedure().. What I did was just copy-pasting the i18n init code right before the gimp_install_procedure() call, and substituting "N_(...)" with "_(...)", like this:

This is not the correct solution. Instead the plug-in is supposed to use gimp_plugin_domain_register() to tell the GIMP core about the textdomain that the plug-in uses for translation. The core will then be able to translate the menu entry.

The rationale behind this is that the GIMP core needs to know the untranslated strings to correctly handle stuff like menu branches.

BTW, it would be nice if we could release an updated version of gimp-plugin-template for GIMP 2.4. Any volunteers to update the template in SVN?

Sven

Michael Schumacher
2007-11-06 11:26:49 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Von: Sven Neumann

BTW, it would be nice if we could release an updated version of gimp-plugin-template for GIMP 2.4. Any volunteers to update the template in SVN?

Here.

I have to figure out why (some) third-party plug-ins don't find their translations on Win32 anyway, and testing this with the plugin template would be a good place to start from.

Michael

Carlo Baldassi
2007-11-10 05:59:21 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Hi,

still about porting plugins form 2.2 to 2.4:

This is not the correct solution. Instead the plug-in is supposed to

use

gimp_plugin_domain_register() to tell the GIMP core about the

textdomain

that the plug-in uses for translation. The core will then be able to translate the menu entry.

In fact, the call to gimp_domain_register() was already present in the gimp-plugin-template:

gimp_plugin_domain_register (PROCEDURE_NAME, LOCALEDIR);

It returns success, but the menu entry is not translated. I couldn't find any help from other plugins' sources because they don't register this way.

Another problem I found is that the GIMP helpbrowser doesn't read the help files correctly (no problem when using firefox, though). The crash occurs in helpbrowser/dialog.c, inside the function browser_dialog_make_index_foreach(), at this point:

indices = g_strsplit (item->title, ".", -1); /* THIS CALL FAILS */

for (i = 0; i < 5; i++) {
if (! indices[i]) /* CRASH HERE */ break;

item->index += atoi (indices[i]) << (8 * (5 - i)); }

and that's because item->title is NULL.

Thus, it seems that I need to register a title somehow, but I didn't find any documentation online about how to prepare an help file. Again, the standard plugins were of no help to me. Any help/hint/clue/link would be appreciated.

BTW, it would be nice if we could release an updated version of gimp-plugin-template for GIMP 2.4. Any volunteers to update the

template

in SVN?

If I manage to get it tworking I would be glad to send you my patches!

Carlo

___________________________________ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html

Sven Neumann
2007-11-10 16:38:11 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Hi,

On Sat, 2007-11-10 at 04:59 +0000, Carlo Baldassi wrote:

In fact, the call to gimp_domain_register() was already present in the gimp-plugin-template:

gimp_plugin_domain_register (PROCEDURE_NAME, LOCALEDIR);

It returns success, but the menu entry is not translated. I couldn't find any help from other plugins' sources because they don't register this way.

Does LOCALEDIR have the correct value? Are the translations actually installed in the folder that it points to?

Another problem I found is that the GIMP helpbrowser doesn't read the help files correctly
(no problem when using firefox, though). The crash occurs in helpbrowser/dialog.c,
inside the function browser_dialog_make_index_foreach(), at this point:

indices = g_strsplit (item->title, ".", -1); /* THIS CALL FAILS */

for (i = 0; i < 5; i++) {
if (! indices[i]) /* CRASH HERE */ break;

item->index += atoi (indices[i]) << (8 * (5 - i)); }

and that's because item->title is NULL.

I've fixed that last night; the fix will be in GIMP 2.4.2.

Thus, it seems that I need to register a title somehow

Your HTML help page needs to have a title, that's all.

Sven

Carlo Baldassi
2007-11-11 00:23:46 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Hi,

In fact, the call to gimp_domain_register() was already present in

the

gimp-plugin-template:

gimp_plugin_domain_register (PROCEDURE_NAME, LOCALEDIR);

It returns success, but the menu entry is not translated. I couldn't find any help from other plugins' sources because they don't register this way.

Does LOCALEDIR have the correct value? Are the translations actually installed in the folder that it points to?

Yes, I checked it directly. Everything else is localized, it's just the menu entry. In fact, the i18n initialization function uses the same location:

bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);

Another problem I found is that the GIMP helpbrowser doesn't read the help files correctly
it seems that I need to register a title somehow

Your HTML help page needs to have a title, that's all.

The HTML page does have a title:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">


Help Page for gimp-plugin-template

I have also tried to use one of the help pages from a standard plugin, as it was, just to test if I was missing some tag: same error.

Carlo

___________________________________ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html

Sven Neumann
2007-11-12 19:43:57 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Hi,

On Sat, 2007-11-10 at 23:23 +0000, Carlo Baldassi wrote:

In fact, the call to gimp_domain_register() was already present in

the

gimp-plugin-template:

gimp_plugin_domain_register (PROCEDURE_NAME, LOCALEDIR);

It returns success, but the menu entry is not translated. I couldn't find any help from other plugins' sources because they don't register this way.

Does LOCALEDIR have the correct value? Are the translations actually installed in the folder that it points to?

Yes, I checked it directly. Everything else is localized, it's just the menu entry.
In fact, the i18n initialization function uses the same location:

bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);

I checked again and it is the other parameter which is wrong:

gimp_plugin_domain_register (PROCEDURE_NAME, LOCALEDIR);

This should be:

gimp_plugin_domain_register (GETTEXT_PACKAGE, LOCALEDIR);

If this is wrong in the plug-in template, then we should fix this and release an updated version as soon as possible.

Sven

Michael Schumacher
2007-11-12 21:47:51 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Sven Neumann wrote:

This should be:

gimp_plugin_domain_register (GETTEXT_PACKAGE, LOCALEDIR);

It is.

main.c:

gimp_plugin_domain_register (GETTEXT_PACKAGE, LOCALEDIR);

HTH, Michael

Carlo Baldassi
2007-11-12 22:26:13 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Hi,

This should be:

gimp_plugin_domain_register (GETTEXT_PACKAGE, LOCALEDIR);

It is.

main.c:

gimp_plugin_domain_register (GETTEXT_PACKAGE, LOCALEDIR);

Is there a more recent version of the plug-in-template I don't know of? I only found the one at ftp://ftp.gimp.org/pub/gimp/plugin-template/ and in that one the register line is wrong.
If so, the link at developer.gimp.org should be updated. Thanks

Carlo

___________________________________ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html

Carlo Baldassi
2007-11-12 22:49:45 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

It is.
gimp_plugin_domain_register (GETTEXT_PACKAGE, LOCALEDIR);

Ooops, sorry, I didn't notice there was an SVN version of the template. It's the link on the sidebar of developer.gimp.org which points to the buggy version. Still, about the other bug, even with the SVN version the help file doesn't work with the helpbrowser in 2.4.1.

Carlo

___________________________________ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html

Sven Neumann
2007-11-12 23:19:16 UTC (about 17 years ago)

problem (solved?) in gimp-plugin-template

Hi,

On Mon, 2007-11-12 at 21:49 +0000, Carlo Baldassi wrote:

Ooops, sorry, I didn't notice there was an SVN version of the template. It's the link on the sidebar of developer.gimp.org which points to the buggy version.

We will release a fixed version of the plug-in template at some point in a not too distant future. Michael is already working on this.

Still, about the other bug, even with the SVN version the help file doesn't work with the helpbrowser in 2.4.1.

As I said already, it should work fine with GIMP 2.4.2 when that is released. And that's only a matter of weeks, if not days only.

Sven