4 # GNOME po update utility.
5 # (C) 2000 The Free Software Foundation
7 # Author(s): Kenneth Christiansen
10 $VERSION = "1.2.5 beta 2";
15 print "update.pl: missing file arguments\n";
16 print "Try `update.pl --help' for more information.\n";
22 if ("$LANG" eq "--version" || "$LANG" eq "-V"){
23 print "GNOME PO Updater $VERSION\n";
24 print "Written by Kenneth Christiansen <kenneth\@gnome.org>, 2000.\n\n";
25 print "Copyright (C) 2000 Free Software Foundation, Inc.\n";
26 print "This is free software; see the source for copying conditions. There is NO\n";
27 print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
32 elsif ($LANG eq "--help" || "$LANG" eq "-H"){
33 print "Usage: ./update.pl [OPTIONS] ...LANGCODE\n";
34 print "Updates pot files and merge them with the translations.\n\n";
35 print " -V, --version shows the version\n";
36 print " -H, --help shows this help page\n";
37 print " -P, --pot only generates the potfile\n";
38 print " -M, --maintain search for missing files in POTFILES.in\n";
39 print "\nExamples of use:\n";
40 print "update.sh --pot just creates a new pot file from the source\n";
41 print "update.sh da created new pot file and updated the da.po file\n\n";
42 print "Report bugs to <kenneth\@gnome.org>.\n";
46 elsif($LANG eq "--pot" || "$LANG" eq "-P"){
48 print "Building the $PACKAGE.pot ...";
50 $b="xgettext --default-domain\=$PACKAGE --directory\=\.\."
51 ." --add-comments=TRANSLATORS: --keyword\=\_ --keyword\=N\_"
52 ." --keyword\=Q\_ --files-from\=\.\/POTFILES\.in ";
53 $b1="test \! -f $PACKAGE\.po \|\| \( rm -f \.\/$PACKAGE\.pot "
54 ."&& mv $PACKAGE\.po \.\/$PACKAGE\.pot \)";
64 elsif ($LANG eq "--maintain" || "$LANG" eq "-M"){
66 $a="find ../ -type f -print | egrep '.*\\.(c|y|cc|c++|cxx|cpp|h|gob)\$' ";
68 open(BUF2
, "POTFILES.in") || die "update.pl: there is no POTFILES.in !!!\n";
69 print "Searching for missing _(\" \") entries...\n";
76 if (-s
"POTFILES.ignore"){
77 open FILE
, "POTFILES.ignore";
83 print "POTFILES.ignore found! Ignoring files...\n";
84 @buf2 = (@bup, @buf2);
87 foreach my $file (@buf1){
91 $file = unpack("x4 A*",$file) . "\n";
98 @bufff1 = sort (@buff1);
100 @bufff2 = sort (@buf2);
108 if (!exists($in2{$_})){
113 open OUT
, ">POTFILES.in.missing";
115 print "\nHere are the results:\n\n", @result, "\n";
116 print "File POTFILES.in.missing is being placed in directory...\n";
117 print "Please add the files that should be ignored in POTFILES.ignore\n";
120 print "\nWell, it's all perfect! Congratulation!\n";
126 print "update.pl: invalid option -- $LANG\n";
127 print "Try `update.pl --help' for more information.\n";
132 elsif(-s
"$LANG.po"){
134 print "Building the $PACKAGE.pot ...";
136 $c="xgettext --default-domain\=$PACKAGE --directory\=\.\."
137 ." --add-comments=TRANSLATORS: --keyword\=\_ --keyword\=N\_"
138 ." --keyword\=Q\_ --files-from\=\.\/POTFILES\.in ";
139 $c1="test \! -f $PACKAGE\.po \|\| \( rm -f \.\/$PACKAGE\.pot "
140 ."&& mv $PACKAGE\.po \.\/$PACKAGE\.pot \)";
147 print "\nNow merging $LANG.po with $PACKAGE.pot, and creating an updated $LANG.po ...\n";
150 $d="mv $LANG.po $LANG.po.old && msgmerge --no-location $LANG.po.old $PACKAGE.pot -o $LANG.po";
152 $f="msgfmt --statistics $LANG.po";
158 unlink "$LANG.po.old";
164 print "update.pl: sorry, $LANG.po doesn't exist!\n";
165 print "Try `update.pl --help' for more information.\n";