forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
m0dB
authored and
m0dB
committed
Jan 4, 2024
1 parent
0291eb2
commit 62437c2
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
sub help { | ||
my $err = shift(@_); | ||
if ($err) { | ||
print "Error: $err\n\n"; | ||
} | ||
print<<EOF; | ||
Script to display a matrix with the amount of differences between translation files. | ||
Usage: | ||
Specify the list of .ts translation files to compare, e.g: | ||
$ cd res/translations/ | ||
$ perl ../../tools/tsdiffmatrix.pl mixxx_es*.ts | ||
$ for base in en es fr pt zh; do perl ../../tools/tsdiffmatrix.pl mixxx_\$base*.ts; done | ||
EOF | ||
exit(-1); | ||
} | ||
|
||
sub pad { | ||
my $s = shift(@_); | ||
return substr("$s ",0,5); | ||
} | ||
|
||
help() if $#ARGV == -1; | ||
foreach $a (@ARGV) { | ||
$a =~ m/mixxx.*_(\w+)\.ts/ || help("Unexpected argument $a"); | ||
} | ||
|
||
print pad(""); | ||
foreach $a (@ARGV) { | ||
if ($a =~ m/mixxx.*_(\w+)\.ts/) { | ||
print pad($1); | ||
} | ||
} | ||
print "\n"; | ||
|
||
foreach $b (@ARGV) { | ||
$b =~ m/mixxx.*_(\w+)\./; | ||
print pad($1); | ||
foreach $a (@ARGV) { | ||
$n = 0; | ||
open(DIFFOUT,"diff $a $b |"); | ||
while (<DIFFOUT>) { | ||
if (m/^(\d+),?(\d*)c(\d+),?(\d*)/) { | ||
$na = $2 ? $2 - $1 : 1; | ||
$nb = $4 ? $4 - $3 : 1; | ||
$n += $na > $nb ? $na : $nb; | ||
} | ||
} | ||
close(DIFFOUT); | ||
print pad($a eq $b ? "" : $n); | ||
} | ||
print "\n"; | ||
} | ||
|
||
print "--------------------------------------------------------------------\n"; |