annotate po/update.pl @ 12413:0332daad85ae

[gaim-migrate @ 14720] Rework the blist sorting functions to cut down on the duplication of GtkTreeIter structs. Fix a void prototype. Make a few functions static. Add a watch cursor while the buddy list refreshes, after changing the sort method. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 08 Dec 2005 21:01:33 +0000
parents d5a2232f83e4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 #!/usr/bin/perl -w
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 # GNOME po update utility.
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 # (C) 2000 The Free Software Foundation
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 #
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 # Author(s): Kenneth Christiansen
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
7 # Patches: Björn Voigt <bjoern@cs.tu-berlin.de>
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 $VERSION = "1.2.5 beta 2";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 $LANG = $ARGV[0];
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 $PACKAGE = "gaim";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 if (! $LANG){
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 print "update.pl: missing file arguments\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 print "Try `update.pl --help' for more information.\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 exit;
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 if ($LANG=~/^-(.)*/){
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 if ("$LANG" eq "--version" || "$LANG" eq "-V"){
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 print "GNOME PO Updater $VERSION\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 print "Written by Kenneth Christiansen <kenneth\@gnome.org>, 2000.\n\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 print "Copyright (C) 2000 Free Software Foundation, Inc.\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 print "This is free software; see the source for copying conditions. There is NO\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 exit;
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 elsif ($LANG eq "--help" || "$LANG" eq "-H"){
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 print "Usage: ./update.pl [OPTIONS] ...LANGCODE\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 print "Updates pot files and merge them with the translations.\n\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 print " -V, --version shows the version\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 print " -H, --help shows this help page\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 print " -P, --pot only generates the potfile\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 print " -M, --maintain search for missing files in POTFILES.in\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 print "\nExamples of use:\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 print "update.sh --pot just creates a new pot file from the source\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 print "update.sh da created new pot file and updated the da.po file\n\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 print "Report bugs to <kenneth\@gnome.org>.\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 exit;
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 elsif($LANG eq "--pot" || "$LANG" eq "-P"){
9836
d5a2232f83e4 [gaim-migrate @ 10707]
Luke Schierer <lschiere@pidgin.im>
parents: 9531
diff changeset
47
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 print "Building the $PACKAGE.pot ...";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 $b="xgettext --default-domain\=$PACKAGE --directory\=\.\."
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 ." --add-comments --keyword\=\_ --keyword\=N\_"
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 ." --files-from\=\.\/POTFILES\.in ";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 $b1="test \! -f $PACKAGE\.po \|\| \( rm -f \.\/$PACKAGE\.pot "
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 ."&& mv $PACKAGE\.po \.\/$PACKAGE\.pot \)";
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
55 if(($ret=system($b . " && " . $b1))==0) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
56 print "...done\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
57 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
58 else {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
59 print "...failed\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
60 }
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
62 exit $ret;
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 }
9836
d5a2232f83e4 [gaim-migrate @ 10707]
Luke Schierer <lschiere@pidgin.im>
parents: 9531
diff changeset
64
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 elsif ($LANG eq "--maintain" || "$LANG" eq "-M"){
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
67 $a="find ../ -path ../intl -prune -o -print | egrep '.*\\.(c|y|cc|c++|h|gob)\$' ";
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 open(BUF2, "POTFILES.in") || die "update.pl: there's not POTFILES.in!!!\n";
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
70 print "Searching for missing _(\" \") entries and for deleted files...\n";
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 open(BUF1, "$a|");
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 @buf2 = <BUF2>;
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 @buf1 = <BUF1>;
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
77 if (-s "POTFILES.ignore") {
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 open FILE, "POTFILES.ignore";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 while (<FILE>) {
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
80 if ($_=~/^[^#]/o) {
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 push @bup, $_;
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 print "POTFILES.ignore found! Ignoring files...\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 @buf2 = (@bup, @buf2);
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
86 }
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
88 foreach my $file (@buf1) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
89 $cmd="xgettext -o - --omit-header --keyword=_ " .
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
90 "--keyword=N_ " . $file . " |";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
91 open XGET, $cmd;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
92 if(<XGET>) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
93 $file = unpack("x3 A*",$file) . "\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
94 push @buff1, $file;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
95 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
96 close XGET;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
97 # open FILE, "<$file";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
98 # while (<FILE>) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
99 # if ($_=~/_\(\"/o || $_=~/ngettext\(\"/o){
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
100 # $file = unpack("x3 A*",$file) . "\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
101 # push @buff1, $file;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
102 # last;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
103 # }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
104 # }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
105 }
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 @bufff1 = sort (@buff1);
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 @bufff2 = sort (@buf2);
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 my %in2;
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 foreach (@bufff2) {
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
113 chomp;
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 $in2{$_} = 1;
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
117 my %in1;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
118 foreach (@bufff1) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
119 chomp;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
120 $in1{$_} = 1;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
121 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
122
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
123 foreach (@bufff1) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
124 chomp;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
125 if (!exists($in2{$_})) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
126 push @result, $_ . "\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
127 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
128 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
129
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
130 foreach (@bufff2) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
131 chomp;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
132 if (! -f "../" . $_) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
133 push @deletedfiles, $_ . "\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
134 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
135 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
136
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
137 foreach (@bufff2) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
138 if (!exists($in1{$_})) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
139 push @noi18nfiles, $_ . "\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
140 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
141 }
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 if(@result){
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 open OUT, ">POTFILES.in.missing";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 print OUT @result;
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
146 print "\nHere are the missing files:\n\n", @result, "\n";
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 print "File POTFILES.in.missing is being placed in directory...\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 print "Please add the files that should be ignored in POTFILES.ignore\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 else{
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
151 unlink("POTFILES.in.missing");
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
152 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
153
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
154 if(@deletedfiles){
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
155 open OUT, ">POTFILES.in.deleted";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
156 print OUT @deletedfiles;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
157 print "\nHere are the deleted files:\n\n", @deletedfiles, "\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
158 print "File POTFILES.in.deleted is being placed in directory...\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
159 print "Please delete the files from POTFILES.in or POTFILES.ignore\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
160 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
161 else{
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
162 unlink("POTFILES.in.deleted");
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
163 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
164
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
165 if(@noi18nfiles){
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
166 open OUT, ">POTFILES.in.noi18n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
167 print OUT @noi18nfiles;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
168 print "\nHere are the files which currently have no i18n strings:\n\n",
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
169 @noi18nfiles, "\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
170 print "File POTFILES.in.noi18n is being placed in directory...\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
171 print "Please delete the files from POTFILES.in or POTFILES.ignore\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
172 print "or ignore the files.\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
173 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
174 else{
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
175 unlink("POTFILES.in.noi18n");
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
176 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
177
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
178 if( ! @result && ! @deletedfiles ) {
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179 print "\nWell, it's all perfect! Congratulation!\n";
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
180 }
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184 else{
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 print "update.pl: invalid option -- $LANG\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 print "Try `update.pl --help' for more information.\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 exit;
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 elsif(-s "$LANG.po"){
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 print "Building the $PACKAGE.pot ...";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 $c="xgettext --default-domain\=$PACKAGE --directory\=\.\."
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 ." --add-comments --keyword\=\_ --keyword\=N\_"
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 ." --files-from\=\.\/POTFILES\.in ";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 $c1="test \! -f $PACKAGE\.po \|\| \( rm -f \.\/$PACKAGE\.pot "
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 ."&& mv $PACKAGE\.po \.\/$PACKAGE\.pot \)";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
201 if(($ret=system($c . " && " . $c1))==0) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
202 print "...done\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
203 }
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
204 else {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
205 print "...failed\n";
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
206 }
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
208 if($ret==0) {
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
209 print "\nNow merging $LANG.po with $PACKAGE.pot, and creating an updated $LANG.po ...\n";
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
212 $d="if msgmerge $LANG.po $PACKAGE.pot -o $LANG.new.po; then " .
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
213 " mv -f $LANG.new.po $LANG.po; " .
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
214 " msgfmt --statistics -c -v -o /dev/null $LANG.po; " .
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
215 "else " .
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
216 " echo \"msgmerge failed!\"; " .
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
217 " rm -f $LANG.new.po; ".
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
218 "fi";
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
220 $ret=system($d);
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221
9531
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
222 exit $ret;
06fe6ed7f63a [gaim-migrate @ 10358]
Luke Schierer <lschiere@pidgin.im>
parents: 5180
diff changeset
223 }
5180
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 }
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 else{
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 print "update.pl: sorry $LANG.po does not exist!\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228 print "Try `update.pl --help' for more information.\n";
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 exit;
ea261ce36f0b [gaim-migrate @ 5544]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230 }