After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720052 - Make GIMP require a more recent gettext (was: po-script-fu/gimp20-script-fu.pot misses most of the strings from scm files)
Make GIMP require a more recent gettext (was: po-script-fu/gimp20-script-fu.p...
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Internationalisation
git master
Other All
: Normal normal
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2013-12-08 08:29 UTC by fordfrog
Modified: 2014-05-03 13:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make GIMP recommend a recent gettext. (3.08 KB, patch)
2014-05-03 06:59 UTC, Jehan
none Details | Review
Make GIMP recommend a recent gettext. (3.08 KB, patch)
2014-05-03 12:31 UTC, Jehan
none Details | Review

Description fordfrog 2013-12-08 08:29:25 UTC
when running `make po-update` for example in po-scripts-fu, pot file misses some strings. i have found out that for scm files there must be specified -L perl to collect all strings. here is an example.

this command does not create test.pot at all:
xgettext --keyword=_ --keyword=N_ --keyword=Q_:1g --keyword=C_:1c,2 --keyword=NC_:1c,2 -o test.pot plug-ins/script-fu/scripts/gimp-online.scm

this command creates test.pot file and it seems to contain all strings:
xgettext -L perl --keyword=_ --keyword=N_ --keyword=Q_:1g --keyword=C_:1c,2 --keyword=NC_:1c,2 -o test.pot plug-ins/script-fu/scripts/gimp-online.scm

so the outcome seems to be that scm files need -L perl to be added to xgettext to collect strings for localization correctly.
Comment 1 fordfrog 2013-12-08 09:51:42 UTC
the command above with -L perl does not extract strings from plug-ins/script-fu/scripts/paste-as-brush.scm so even when using -L perl, some strings are ommitted.

forgot to mention that i use gettext-0.18.3.1.
Comment 2 Jehan 2013-12-08 10:27:23 UTC
Hi,

Thanks for the report. When you say that the pot file misses some strings, are you getting some build error or warning? Because I've just tried a `make update-po` in po-scripts-fu, after deleting the current pot file to make sure and it all went well. No error on screen.

Or did you check the pot file manually and saw that some specific strings were missing? If so, which?

For info, I use gettext 0.18.1.
Comment 3 fordfrog 2013-12-08 10:34:22 UTC
generally, it contains only strings from scm files that are like (_"string"...

when i ran xgettext on scm files and updated the pot files, number of strings increased from 57 to 159. and it still misses strings from plug-ins/script-fu/scripts/paste-as-brush.scm for example (did not check other files).

and there really is no error when running the make command.


you can try `grep "New _Brush" po-script-fu/gimp20-script-fu.pot' for example. that string comes from the mentioned plug-ins/script-fu/scripts/paste-as-brush.scm.

also there are imo two cases:
1) scm files that are not processed correctly by make but using xgettext, the strings can be added to the pot file
2) files like plug-ins/script-fu/scripts/paste-as-brush.scm that even xgettext does not extract strings from.

if needed, you can reach me at irc as fordfrog.
Comment 4 fordfrog 2013-12-08 10:40:13 UTC
you can use following steps to see the effect:

cd po-script-fu
rm gimp20-script-fu.pot
make update-po
cd ..
grep scm po-script-fu/POTFILES.in | xgettext -L perl --keyword=_ --keyword=N_ --keyword=Q_:1g --keyword=C_:1c,2 --keyword=NC_:1c,2 -o po-script-fu/gimp20-script-fu.pot -f -
cd po-script-fu
make update-po

notice the number of strings that are processed now. and it still misses some strings.
Comment 5 Jehan 2013-12-08 12:07:12 UTC
Yep you're right.

Unfortunately the fix is not as easy as simply adding the "-L perl" option to the xgettext command, first because it would be the wrong option. '.scm' files are script-fu=Scheme files. So the right option would be "-L Scheme". Second because xgettext can recognize the language from the .scm extension anyway; but if we were to force the "-L Scheme" option, it would consider all files in POTFILES.in as Scheme files, thus extraction of strings from C files would break (since this POTFILES has both C and script-fu scripts). Lastly because that seems to be a problem in xgettext or in our code apparently.

xgettext considers that a function in scheme has the form (fun-name parameter), thus expects all translatable strings to be similarly (_ "some string"). For some reason, it won't recognize the _"some string" syntax. I really wonder how nobody saw this before. That was working before, so something must have changed.

Maybe someone else knows what is the problem?
Comment 6 Michael Natterer 2013-12-10 21:41:55 UTC
What happened to the but that originally tracked this problem?
Comment 7 Jehan 2013-12-11 01:32:57 UTC
Mitch, I'm not sure what you mean.
Comment 8 Michael Natterer 2013-12-11 08:31:06 UTC
I mean that this is a known problem and we had a bug about it, but I don't
find it.
Comment 9 Jehan 2013-12-12 09:06:55 UTC
Well I can't find it either. There are only 7 reports in "internationalization", and it's not there.  So either it has been closed by mistake, or it is in the wrong section. :-/
Comment 10 Michael Natterer 2013-12-12 10:22:09 UTC
Or it was moved to another product. Kevin?
Comment 11 Kevin Cozens 2013-12-12 19:11:23 UTC
I have searched all reports using my email address but I have not found it yet. I would have put a watch on the old bug report and commented on it to explain why translations are missing. I lost some of my saved GIMP developer email when Thunderbird ate them when I updated to my new hard drives.
Comment 12 Marco Ciampa 2014-04-30 11:03:46 UTC
Closed in gettext:

https://savannah.gnu.org/bugs/?42232

Hmm, I wonder why they chose the syntax extension instead of the normal function call. Pushed an ad-hoc patch anyway:
http://git.savannah.gnu.org/cgit/gettext.git/commit/?h=maint&id=b1657be3e0236a29562c0a261a9d2a515e117c45
Comment 13 Michael Natterer 2014-04-30 11:31:12 UTC
I guess we will have to depend on that version of gettext, or at least
warn at configure time if it's too old? What version will have the fix?
Comment 14 Marco Ciampa 2014-04-30 14:00:55 UTC
gettext 0.18.3 and olders are known to have problems with script-fu.

I do not know which final version will be, actual (patched) git version report:

gettext --version
gettext (GNU gettext-runtime) 0.18.3.117-7880

but this is a develop version. Maybe 0.18.4.
Comment 15 Jehan 2014-05-03 06:59:41 UTC
Created attachment 275736 [details] [review]
Make GIMP recommend a recent gettext.

I contacted Daiki Ueno to ask for the version. Below his answer:

« It will be 0.19, since it will also contain non-trivial changes to
po/Makefile.in.in.  I'll call for pretesting next week, so it would be
great if you got a chance to test before migrating. »

Attached a patch where we can check for the gettext version. But as Mitch suggested, I think we should not block the whole build, just warn, since this version is not even out yet, and most people won't have it. But at least we should warn for packagers to know there will be localization problem.

Has someone tested the development gettext to make sure this is fixed, so that we can also confirm upstream?
Comment 16 Jehan 2014-05-03 10:01:57 UTC
Actually I compiled and tested the development xgettext. Seems to work fine.

Before:

$ make update-po
[... snip ...]
fr:
......... done.
57 translated messages.
[... snip ...]

Now:

$ make update-po
[... snip ...]
fr:
......................................... done.
369 translated messages, 2 fuzzy translations, 3 untranslated messages.

[... snip ...]
Comment 17 Marco Ciampa 2014-05-03 12:26:19 UTC
Please Jean would you be so kind to update all po-script-fu strings in branch gimp-2-8 and master? 

Thanks!
Comment 18 Jehan 2014-05-03 12:31:04 UTC
Created attachment 275746 [details] [review]
Make GIMP recommend a recent gettext.

Small fix. Use "$XGETTEXT" rather than "xgettext" when checking the installed version.
Comment 19 Jehan 2014-05-03 12:50:39 UTC
Marco: done.
Comment 20 Michael Natterer 2014-05-03 13:32:32 UTC
Jehan, please proceed with this bug as you see fit.
Comment 21 Jehan 2014-05-03 13:41:48 UTC
commit feb1bf2797d87a24bea1ddc68eafac2db2e83ce4
Author: Jehan <jehan@girinstud.io>
Date:   Sat May 3 18:54:47 2014 +1200

    Bug 720052 - Make GIMP recommend a recent gettext.
    
    Script-fu gettext strings were mostly not extracted by xgettext. This
    will be fixed in upcoming gettext 0.19. Add a test to warn packagers
    using older gettext.