[LON-CAPA-cvs] cvs: loncom /localize/localize synch.pl
bisitz
bisitz@source.lon-capa.org
Wed, 03 Jun 2009 16:33:15 -0000
bisitz Wed Jun 3 16:33:15 2009 EDT
Modified files:
/loncom/localize/localize synch.pl
Log:
Changed list of processed files from blacklist to whitelist:
Only synchronize translation files which are included in the list.
Index: loncom/localize/localize/synch.pl
diff -u loncom/localize/localize/synch.pl:1.12 loncom/localize/localize/synch.pl:1.13
--- loncom/localize/localize/synch.pl:1.12 Fri Jan 16 15:20:29 2009
+++ loncom/localize/localize/synch.pl Wed Jun 3 16:33:15 2009
@@ -21,11 +21,22 @@
# 1: display, 0: don't display
my $debug=0;
-# List of files to be ignored when synching
-# These files don't contain actual translation phrases
-my @ignorefiles=(
- "x_chef.pm"
- ,"en.pm"
+# List of files to be accepted as translation files for synching
+# These files contain actual translation phrases.
+# If you want to exclude translation files from being included
+# in the synching process, remove their file names from this list.
+my @listoffiles=(
+ 'ar.pm'
+ ,'de.pm'
+ ,'es.pm'
+ ,'fa.pm'
+ ,'fr.pm'
+ ,'he.pm'
+ ,'ja.pm'
+ ,'pt.pm'
+ ,'ru.pm'
+ ,'tr.pm'
+ ,'zh.pm'
);
# ----------------------------------------------------------------
@@ -74,10 +85,10 @@
return %lexicon;
}
-sub ignorefile {
+sub takethisfile {
my $file = shift;
- foreach my $ignfile (@ignorefiles) {
- if ($ignfile eq $file) { return 1 }
+ foreach my $listfile (@listoffiles) {
+ if ($listfile eq $file) { return 1 }
}
return 0;
}
@@ -104,10 +115,11 @@
# Add all the different phrases of all translation files to master hash
foreach (<*.pm>) {
- if (&ignorefile($_)) { next }
- print " Reading '".$_."'... ";
- %master=(%master,&readlexicon($_));
- print "ok.\n";
+ if (&takethisfile($_)) {
+ print " Reading '".$_."'... ";
+ %master=(%master,&readlexicon($_));
+ print "ok.\n";
+ }
}
# Ignore all phrases found in removephrases.txt for current synchronization.
@@ -129,7 +141,7 @@
print "Synchronization:\n";
my $quotwarn=0;
foreach my $fn (<*.pm>) {
- if (&ignorefile($fn)) { next }
+ if (!&takethisfile($fn)) { next }
print " Synching '".$fn."'... ";
# Build hash with all translations of current translation file
my %lang=&readlexicon($fn);