Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools/check_missing_voices.pl
diff options
context:
space:
mode:
authorBruno Coudoin <bcoudoin@src.gnome.org>2006-07-14 18:26:08 (GMT)
committer Bruno Coudoin <bcoudoin@src.gnome.org>2006-07-14 18:26:08 (GMT)
commite9a349629c6cdd929517028fbdfb4a6e390e2dc0 (patch)
treed38a66745885f4eaa0130c045f82ebb1c0e100dc /tools/check_missing_voices.pl
parent2fd3f5043f8c81e891f6e99d796ca602b06ea9e1 (diff)
- Fixed location and name of many voices
- added the tool check_missing_voices.pl to replace list_missing_sounds.sh * configure.in: added marathi voices * gcompris.spec.in: added marathi voices * src/gcompris/Makefile.mingw: fixed to compile again on windows
Diffstat (limited to 'tools/check_missing_voices.pl')
-rwxr-xr-xtools/check_missing_voices.pl80
1 files changed, 80 insertions, 0 deletions
diff --git a/tools/check_missing_voices.pl b/tools/check_missing_voices.pl
new file mode 100755
index 0000000..10e922d
--- /dev/null
+++ b/tools/check_missing_voices.pl
@@ -0,0 +1,80 @@
+#!/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/sounds";
+
+# 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)
+ {
+ opendir DIR, "$BASEDIR/$locale/$subdir"
+ or die "cannot open dir $BASEDIR/$locale/$subdir: $!";
+ 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"