MT2116: Addons to the CSV export
[koha.git] / misc / translator / install.pl
blobae5e4b9f68ab776b5d1d34acf158598e04ea0f25
1 #!/usr/bin/perl
2 # script to update all translations
3 use strict;
4 use warnings;
5 use lib '/home/jmf/kohaclone';
6 use C4::Languages;
7 # Go through the theme/module combinations we need to update.
8 my $dir = "po";
9 my $po;
10 opendir (DIR,$dir);
11 while (defined($po = readdir(DIR))) {
12 next if $po =~ /(^\.\.?$|img|fam)/;
13 $po =~ /^(.*)-i-(staff|opac).*/;
14 print "lang: $1 interface:$2\n";
15 my ($lang,$interface) = ($1,$2);
16 $interface =~ s/staff/intranet/;
17 system("mkdir ../../koha-tmpl/$interface-tmpl/prog/$lang");
18 system("./tmpl_process3.pl install -i ../../koha-tmpl/$interface-tmpl/prog/en/ -o ../../koha-tmpl/$interface-tmpl/prog/$lang -s po/$po -r");
20 closedir DIR;
22 =head
23 my($theme, $module) = @$spec;
24 my $pid = fork;
25 die "fork: $!\n" unless defined $pid;
26 if (!$pid) {
28 # If current directory is translator/po instead of translator,
29 # then go back to the parent
30 if ($chdir_needed_p) {
31 chdir('..') || die "..: cd: $!\n";
34 # Now call tmpl_process3.pl to do the real work
36 # Traditionally, the pot file should be named PACKAGE.pot
37 # (for Koha probably something like koha_intranet_css.pot),
38 # but this is not Koha's convention.
40 my $target = "po/${theme}_${module}" . ($pot_p? ".pot": "_$lang.po");
41 rename($target, "$target~") if $pot_p;
42 exec('./tmpl_process3.pl', ($pot_p? 'create': 'update'),
43 '-i', "../../koha-tmpl/$module-tmpl/$theme/en/",
44 '-s', $target, '-r');
46 die "tmpl_process3.pl: exec: $!\n";
48 wait;
50 =cut