i18n/src/messenger/tools/sortit.pl
Evgeny Gryaznov 2f2120e21a update tools for 1.6.2
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@617 c66351dc-e62f-0410-b875-e3a5c0b9693f
2009-08-10 15:52:48 +00:00

34 lines
630 B
Perl
Executable File

#!/usr/bin/perl
sub sort_transl($) {
my($from) = @_;
my @translation = ();
my $header = "";
open(IN, "$from");
while(<IN>) {
chomp;
my $curr = $_;
if(/^([\w\.]+)=(.*)$/) {
if($1 ne "encoding" && $1 ne "output_charset" && $1 ne "output_encoding") {
push @translation, $curr;
} else {
$header .= "$curr\n";
}
} else {
die "wrong line in $from: $curr\n";
}
}
close(IN);
open(OUT, "> $from");
print OUT $header;
for$line(sort @translation) {
print OUT "$line\n";
}
close(OUT);
}
die "no parameter\n" if $#ARGV < 0;
die "doesn't exists\n" unless -e $ARGV[0];
sort_transl($ARGV[0]);