3 # Convenience script to update two po files at once
4 # This emulates the GNOME "update.pl" script
10 use vars qw( $pot_p );
17 die <<EOF unless $pot_p || $lang =~ /^[a-z]{2}(?:_[A-Z]{2})?$/;
22 # Remember whether we see the "po" directory; this is used later to guess
23 # whether the current directory is translator/po or translator.
24 my $chdir_needed_p = 1 unless -d('po');
26 # Go through the theme/module combinations we need to update. There can be
27 # more than two; e.g., if we want ['default', 'opac'] too we can put it in
30 ['default', 'intranet']
32 my($theme, $module) = @$spec;
34 die "fork: $!\n" unless defined $pid;
37 # If current directory is translator/po instead of translator,
38 # then go back to the parent
39 if ($chdir_needed_p) {
40 chdir('..') || die "..: cd: $!\n";
43 # Now call tmpl_process3.pl to do the real work
45 # Traditionally, the pot file should be named PACKAGE.pot
46 # (for Koha probably something like koha_intranet_css.pot),
47 # but this is not Koha's convention.
49 my $target = "po/${theme}_${module}" . ($pot_p? ".pot": "_$lang.po");
50 rename($target, "$target~") if $pot_p;
51 exec('./tmpl_process3.pl', ($pot_p? 'create': 'update'),
52 '-i', "../../koha-tmpl/$module-tmpl/$theme/en/",
55 die "tmpl_process3.pl: exec: $!\n";