3 # GNOME po update utility.
4 # (C) 2000 The Free Software Foundation
6 # Author(s): Kenneth Christiansen
9 $VERSION = "1.2.5 beta 2";
14 print "update.pl: missing file arguments\n";
15 print "Try `update.pl --help' for more information.\n";
21 if ("$LANG" eq "--version" || "$LANG" eq "-V"){
22 print "GNOME PO Updater $VERSION\n";
23 print "Written by Kenneth Christiansen <kenneth\@gnome.org>, 2000.\n\n";
24 print "Copyright (C) 2000 Free Software Foundation, Inc.\n";
25 print "This is free software; see the source for copying conditions. There is NO\n";
26 print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
31 elsif ($LANG eq "--help" || "$LANG" eq "-H"){
32 print "Usage: ./update.pl [OPTIONS] ...LANGCODE\n";
33 print "Updates pot files and merge them with the translations.\n\n";
34 print " -V, --version shows the version\n";
35 print " -H, --help shows this help page\n";
36 print " -P, --pot only generates the potfile\n";
37 print " -M, --maintain search for missing files in POTFILES.in\n";
38 print "\nExamples of use:\n";
39 print "update.sh --pot just creates a new pot file from the source\n";
40 print "update.sh da created new pot file and updated the da.po file\n\n";
41 print "Report bugs to <kenneth\@gnome.org>.\n";
45 elsif($LANG eq "--pot" || "$LANG" eq "-P"){
47 print "Building the $PACKAGE.pot ...";
49 $b="xgettext --default-domain\=$PACKAGE --directory\=\.\."
50 ." --add-comments --keyword\=\_ --keyword\=N\_"
51 ." --files-from\=\.\/POTFILES\.in ";
52 $b1="test \! -f $PACKAGE\.po \|\| \( rm -f \.\/$PACKAGE\.pot "
53 ."&& mv $PACKAGE\.po \.\/$PACKAGE\.pot \)";
63 elsif ($LANG eq "--maintain" || "$LANG" eq "-M"){
65 $a="find ../ -type f -print | egrep '.*\\.(c|y|cc|c++|h|gob)' ";
67 open(BUF2
, "POTFILES.in") || die "update.pl: there's not POTFILES.in!!!\n";
68 print "Searching for missing _(\" \") entries...\n";
75 if (-s
"POTFILES.ignore"){
76 open FILE
, "POTFILES.ignore";
82 print "POTFILES.ignore found! Ignoring files...\n";
83 @buf2 = (@bup, @buf2);
86 foreach my $file (@buf1){
90 $file = unpack("x3 A*",$file) . "\n";
97 @bufff1 = sort (@buff1);
99 @bufff2 = sort (@buf2);
107 if (!exists($in2{$_})){
112 open OUT
, ">POTFILES.in.missing";
114 print "\nHere are the results:\n\n", @result, "\n";
115 print "File POTFILES.in.missing is being placed in directory...\n";
116 print "Please add the files that should be ignored in POTFILES.ignore\n";
119 print "\nWell, it's all perfect! Congratulation!\n";
125 print "update.pl: invalid option -- $LANG\n";
126 print "Try `update.pl --help' for more information.\n";
131 elsif(-s
"$LANG.po"){
133 print "Building the $PACKAGE.pot ...";
135 $c="xgettext --default-domain\=$PACKAGE --directory\=\.\."
136 ." --add-comments --keyword\=\_ --keyword\=N\_"
137 ." --files-from\=\.\/POTFILES\.in ";
138 $c1="test \! -f $PACKAGE\.po \|\| \( rm -f \.\/$PACKAGE\.pot "
139 ."&& mv $PACKAGE\.po \.\/$PACKAGE\.pot \)";
146 print "\nNow merging $LANG.po with $PACKAGE.pot, and creating an updated $LANG.po ...\n";
149 $d="mv $LANG.po $LANG.po.old && msgmerge $LANG.po.old $PACKAGE.pot -o $LANG.po";
151 $f="msgfmt --statistics $LANG.po";
157 unlink "$LANG.po.old";
163 print "update.pl: sorry $LANG.po does not exist!\n";
164 print "Try `update.pl --help' for more information.\n";