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 131885 - intltool-update should support separate per-directory specification of keywords for xgettext
intltool-update should support separate per-directory specification of keywor...
Status: RESOLVED FIXED
Product: intltool
Classification: Deprecated
Component: general
unspecified
Other other
: Normal normal
: ---
Assigned To: intltool maintainers
intltool maintainers
Depends on:
Blocks:
 
 
Reported: 2004-01-19 04:02 UTC by Danilo Segan
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6


Attachments
Get external --keyword's for xgettext (1.18 KB, patch)
2004-01-19 04:07 UTC, Danilo Segan
none Details | Review

Description Danilo Segan 2004-01-19 04:02:42 UTC
Gtk+ module has been split into two domains, but not based on the
directory, but based on xgettext keywords used (i.e. N_, _ vs. P_).

This is a patch which reads Makefile.in.in in current directory, and
extracts XGETTEXT_KEYWORDS variable.  If it's not present, it uses the same
parameters as before.

In order to make use of this, file Makefile.in.in needs to have line along
the following:
XGETTEXT_KEYWORDS = --keyword --keyword=P_
(this one applies to gtk+/po-properties case)

2004-01-19  Danilo Šegan  <dsegan@gmx.net>

	* intltool-update.in (FindPOTKeywords): Searches Makefile.in.in
	for XGETTEXT_KEYWORDS.
	(GeneratePOTemplate): Use FindPOTKeywords to get XGETTEXT_KEYWORDS.
Comment 1 Danilo Segan 2004-01-19 04:07:40 UTC
Created attachment 23507 [details] [review]
Get external --keyword's for xgettext
Comment 2 Matthias Clasen 2004-01-19 07:49:46 UTC
Thats exactly what I would have proposed myself. One could try to 
avoid Makefile.in.in changes and try to directly parse the $XGETTEXT 
invokation, but your approach is probably a lot simpler and more 
reliable.
Comment 3 Kenneth Rohde Christiansen 2004-01-19 08:57:56 UTC
Yes that seems like a nice sollution so go ahead and commit. Btw, is
it possible for you to document this in the README?
Comment 4 Danilo Segan 2004-01-19 10:06:07 UTC
Ok, fixed in CVS.  Since we need to make translators use this, a
release is probably very needed.

Kenneth, how about this text for README:

Changing keywords used in xgettext invocation
.............................................

If you need to change default keywords used to extract messages from 
source code, you need to add variable XGETTEXT_KEYWORDS to 
Makefile.in.in file inside directory whereis intltool-update is run
from, eg.

        --- start ----

        XGETTEXT_KEYWORDS = --keyword --keyword=P_

        --- end ----

Default keywords xgettext looks for if no XGETTEXT_KEYWORDS is defined
are _, N_ and U_. 
Comment 5 Danilo Segan 2004-01-19 10:07:53 UTC
Uhm, replace "whereis" above with "where" -- sorry for the spam.
Comment 6 Danilo Segan 2004-01-20 10:57:14 UTC
I introduced a bug with these changes -- if no Makefile.in.in is
present at all (it's quite rare, but it happens when package is not
using autotools), then FindPOTKeywords dies.  It should actually
return the same default keywords.

Patch below fixes this. Ok to commit?

--- intltool-update~    Mon Jan 19 04:54:30 2004
+++ intltool-update     Tue Jan 20 11:45:02 2004
@@ -947,16 +947,16 @@
 sub FindPOTKeywords
 {
 
+    my $keywords = "--keyword\=\_ --keyword\=N\_ --keyword\=U\_";
     my $make_source; { 
        local (*IN);
-       open (IN, "<Makefile.in.in") || die "can't open
Makefile.in.in: $!";
+       open (IN, "<Makefile.in.in") || return $keywords;
        seek (IN, 0, 0);
        local $/; # slurp mode
        $make_source = <IN>;
        close IN;
     }
 
-    my $keywords = "--keyword\=\_ --keyword\=N\_ --keyword\=U\_";
     # \s makes this not work, why?
     $keywords = $1 if $make_source =~ /^XGETTEXT_KEYWORDS[
]*=\[?([^\n\]]+)/m;
     
Comment 7 Kenneth Rohde Christiansen 2004-01-20 18:54:28 UTC
Yes, please
Comment 8 Danilo Segan 2004-01-21 08:09:54 UTC
Ok, done.