GNOME Bugzilla – 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)
Last modified: 2014-05-03 13:41:48 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.
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.
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.
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.
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.
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?
What happened to the but that originally tracked this problem?
Mitch, I'm not sure what you mean.
I mean that this is a known problem and we had a bug about it, but I don't find it.
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. :-/
Or it was moved to another product. Kevin?
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.
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
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?
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.
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?
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 ...]
Please Jean would you be so kind to update all po-script-fu strings in branch gimp-2-8 and master? Thanks!
Created attachment 275746 [details] [review] Make GIMP recommend a recent gettext. Small fix. Use "$XGETTEXT" rather than "xgettext" when checking the installed version.
Marco: done.
Jehan, please proceed with this bug as you see fit.
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.