blob: 612374ba6b7bca2200b969a1d58e9ee1ed0eefc4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/usr/bin/perl
#
# Run this program in the top level GCompris directory
# with a locale parameter like ./check_missing_voices fr
#
# It will tell you which voices are missing
#
use strict;
use Data::Dumper;
if(!defined $ARGV[0])
{
print "Usage: ./check_missing_voices <locale>\n";
print " e.g. ./check_missing_voices fr\n";
exit 1;
}
my $TARGET_LOCALE = $ARGV[0];
my $BASEDIR="./boards/voices";
# I don't set alphabet dir, it's too locale specific
my @SUBDIRS= qw/geography misc colors/;
if(! -d $BASEDIR)
{
print "ERROR: You must run this tool from the top GCompris directory this way:\n";
print " ./tools/check_missing_voices.pl $TARGET_LOCALE\n";
exit(1);
}
my @LOCALES;
foreach my $file (`ls $BASEDIR`)
{
chomp($file);
if (-d "$BASEDIR/$file" &&
($file =~ /^[a-z]{2}$/ || $file =~ /^[a-z]{2}_[a-zA-Z]{2}$/))
{
push(@LOCALES, $file);
}
}
printf("Locale already supported: @LOCALES\n");
# Create the longest list possible
my @ALL_FILES;
foreach my $locale (@LOCALES)
{
foreach my $subdir (@SUBDIRS)
{
if (! opendir DIR, "$BASEDIR/$locale/$subdir")
{
print "cannot open dir $BASEDIR/$locale/$subdir: $!\n";
next;
}
foreach my $file ( grep { $_ =~ /\.ogg$/} readdir DIR)
{
if("@ALL_FILES" !~ /$subdir\/$file/g)
{
push(@ALL_FILES, "$subdir/$file");
}
}
closedir DIR;
}
}
#
# Now we have the uniq list of all the files of all locales.
# We now check each one is translated in the target locale
#
print "Missing files for locale '$TARGET_LOCALE':\n";
my $got_error = 0;
foreach my $file (@ALL_FILES)
{
if(! -f "$BASEDIR/$TARGET_LOCALE/$file")
{
print "$file\n";
$got_error = 1;
}
}
print "\nGreat, nothing is missing !\n" if !$got_error;
print "\nI did not checked the directory '$BASEDIR/$TARGET_LOCALE/alphabet'\n"
|