]> Pileus Git - ~andy/gtk/blob - po/desk.pl
Add comment about gtk-1-3-win32-production branch currently being ahead in
[~andy/gtk] / po / desk.pl
1 #!/usr/bin/perl -w
2
3 #  GNOME entry finder utility.
4 #  (C) 2000 The Free Software Foundation
5
6 #  Author(s): Kenneth Christiansen
7
8
9 $VERSION = "1.0.0 beta 5";
10 $LANG    = $ARGV[0];
11 $OPTION2 = $ARGV[1];
12 $SEARCH  = "Name";
13
14 if (! $LANG){
15     print "desk.pl:  missing file arguments\n";
16     print "Try `desk.pl --help' for more information.\n";
17     exit;
18 }
19
20 if ($OPTION2){
21     $SEARCH=$OPTION2;
22 }
23
24 if ($LANG){
25
26 if ($LANG=~/^-(.)*/){
27
28     if ("$LANG" eq "--version" || "$LANG" eq "-V"){
29         print "GNOME Entry finder $VERSION\n";
30         print "Written by Kenneth Christiansen <kenneth\@gnome.org>, 2000.\n\n";
31         print "Copyright (C) 2000 Free Software Foundation, Inc.\n";
32         print "This is free software; see the source for copying conditions.  There is NO\n";
33         print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
34         exit;
35     }
36
37     elsif ($LANG eq "--help" || "$LANG" eq "-H"){
38         print "Usage: ./desk.pl [OPTIONS] ...LANGCODE ENTRY\n";
39         print "Checks .desktop and alike files for missing translations.\n\n";
40         print "  -V, --version                shows the version\n";
41         print "  -H, --help                   shows this help page\n";
42         print "\nReport bugs to <kenneth\@gnome.org>.\n";
43         exit;
44     }
45
46     else{
47         print "desk.pl: invalid option -- $LANG\n";
48         print "Try `desk.pl --help' for more information.\n";
49         exit;
50     }
51 }
52
53 else{
54
55     $a="find ../ -print | egrep '.*\\.(desktop|soundlist"
56       ."|directory)' ";
57
58     $b="find ../ -print | egrep '.*\\.(desktop|soundlist"
59       ."|directory)' "; 
60
61     print "Searching for missing $SEARCH\[$LANG\] entries...\n";
62
63     open(BUF1, "$a|");
64     open(BUF2, "$b|");
65
66     @buf1 = <BUF1>;
67     foreach my $file (@buf1){ 
68         open FILE, "<$file";
69         while (<FILE>) {
70            if ($_=~/$SEARCH\[$LANG\]\=/o){ 
71                 $file = unpack("x2 A*",$file) . "\n";           
72                 push @buff1, $file;
73                 last;
74            }
75         }
76     }
77
78     @buf2 = <BUF2>;
79     foreach my $file (@buf2){
80         open FILE, "<$file";
81         while (<FILE>) {
82            if ($_=~/$SEARCH\=/o){
83                 $file = unpack("x2 A*",$file) . "\n";
84                 push @buff2, $file;
85                 last;
86            }
87         }
88     }
89
90     @bufff1 = sort (@buff1);
91     @bufff2 = sort (@buff2);
92
93     my %in2;
94     foreach (@bufff1) {
95         $in2{$_} = 1;
96     }
97  
98    foreach (@bufff2){
99         if (!exists($in2{$_})){
100             push @result, $_ } 
101         }
102     }
103
104     open(OUT1, ">MISSING.$LANG.$SEARCH");
105        print OUT1 @result ;
106     close OUT1;
107
108
109     stat("MISSING.$LANG.$SEARCH");
110         print "\nWell, you need to fix these:\n\n" if -s _;
111         print @result if -s _;
112         print "\nThe list is saved in MISSING.$LANG.$SEARCH\n" if -s _;
113         print "\nWell, it's all perfect! Congratulation!\n" if -z _;
114         unlink "MISSING.$LANG.$SEARCH" if -z _;
115     exit;       
116 }
117
118