More comments in the code to explain what it does

and check the language code command line argument a bit more carefully
This commit is contained in:
acli 2005-01-11 09:50:58 +00:00
parent 25ff5e4354
commit f1680e06d5
1 changed files with 19 additions and 4 deletions

View File

@ -7,19 +7,34 @@ use strict;
use integer;
my $lang = $ARGV[0];
die "Usage: $0 LANG\n" unless defined $lang && $lang =~ /\S/;
die "Usage: $0 LANG\n" unless $lang =~ /^[a-z]{2}(?:_[A-Z]{2})?$/;
my $chdir_needed_p = 1 unless -d('po'); # guess if pwd is translator/ or po/
# Remember whether we see the "po" directory; this is used later to guess
# whether the current directory is translator/po or translator.
my $chdir_needed_p = 1 unless -d('po');
for my $spec (['css', 'opac'], ['default', 'intranet']) {
# Go through the theme/module combinations we need to update. There can be
# more than two; e.g., if we want ['default', 'opac'] too we can put it in
for my $spec (
['css', 'opac' ],
['default', 'intranet']
) {
my($theme, $module) = @$spec;
my $pid = fork;
die "fork: $!\n" unless defined $pid;
if (!$pid) {
# If current directory is translator/po instead of translator,
# then go back to the parent
if ($chdir_needed_p) {
chdir('..') || die "..: cd: $!\n";
}
exec('./tmpl_process3.pl', 'update', '-i', "../../koha-tmpl/$module-tmpl/$theme/en/", '-s', "po/${theme}_${module}_$lang.po", '-r');
# Now call tmpl_process3.pl to do the real work
exec('./tmpl_process3.pl', 'update',
'-i', "../../koha-tmpl/$module-tmpl/$theme/en/",
'-s', "po/${theme}_${module}_$lang.po", '-r');
die "tmpl_process3.pl: exec: $!\n";
}
wait;