]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
TOOLS: new script langdiff added. With this script one can check a languagefile again...
authorAlexander Marx <amarx@ipfire.org>
Fri, 13 Dec 2013 07:03:23 +0000 (08:03 +0100)
committerAlexander Marx <amarx@ipfire.org>
Fri, 13 Dec 2013 07:03:23 +0000 (08:03 +0100)
tools/langdiff.pl [new file with mode: 0755]

diff --git a/tools/langdiff.pl b/tools/langdiff.pl
new file mode 100755 (executable)
index 0000000..6ce313d
--- /dev/null
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+
+my @one=();
+my @two=();
+
+my $file1;
+my $file2;
+my $cnt=0;
+my $numArgs = $#ARGV + 1;
+if ($numArgs !=2 ){
+       print"Usage:  langdiff.pl <languagefile1 - incomplete> <languagefile2 - complete>\n";
+       exit;
+}else{
+       $file1=$ARGV[0];
+       $file2=$ARGV[1];
+}
+
+open(FILE1, $file1) or die 'Unable to open file $file1.';
+my @one = <FILE1>;
+close(FILE1);
+undef ($one[0]);
+undef ($one[1]);
+undef ($one[2]);
+undef ($one[3]);
+undef ($one[$#one-1]);
+undef ($one[$#one-2]);
+open(FILE2, $file2) or die 'Unable to open file $file2.';
+my @two = <FILE2>;
+close(FILE2);
+undef ($two[0]);
+undef ($two[1]);
+undef ($two[2]);
+undef ($two[3]);
+undef ($two[$#two-1]);
+undef ($two[$#two-2]);
+open(FILE3, ">language-diff.txt") or die 'Unable to open config file.';
+
+foreach my $line (@two){
+       my ($a,$b) = split ("=>",$line);
+       if(!&is_in_array($a)){
+               $cnt++;
+               print FILE3 "$a => $b";
+       }
+}
+
+sub is_in_array{
+       my $val = shift;
+
+       foreach my $line1 (@one){
+               my ($c,$d) = split ("=>",$line1);
+               return 1 if ($val eq $c);
+       }
+       return 0;
+}
+
+
+print"$cnt lines from $file2 are not existent in $file1. Please check language-diff.txt for details.\n\n";