GNOME Bugzilla – Bug 131885
intltool-update should support separate per-directory specification of keywords for xgettext
Last modified: 2004-12-22 21:47:04 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.
Created attachment 23507 [details] [review] Get external --keyword's for xgettext
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.
Yes that seems like a nice sollution so go ahead and commit. Btw, is it possible for you to document this in the README?
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_.
Uhm, replace "whereis" above with "where" -- sorry for the spam.
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;
Yes, please
Ok, done.