Release Notes for 3.0-stable
[koha.git] / misc / translator / install-code.pl
1 #!/usr/bin/perl
2
3 use strict;
4
5 =head1 NAME
6
7 install-code.pl 
8
9 =head1 USAGE
10
11 Install templates for given language codes.
12
13 For example:
14
15    ./install-code fr-FR en-ES
16
17 creates templates for languages: fr-FR and en-ES
18
19 =cut
20
21
22
23 sub install_code {
24     my $code = shift;
25     opendir(PO_DIR, "po") or die "Unable to open po directory";
26     my @po_files = grep { /^$code-i-opac|^$code-i-staff/ } readdir PO_DIR;
27     closedir PO_DIR;
28     
29     foreach ( @po_files ) {
30         my ($interface) = /(staff|opac)/;
31         $interface =~ s/staff/intranet/;        
32         mkdir "../../koha-tmpl/$interface-tmpl/prog/$code";
33         print $_, " : ", $interface, "\n";
34         my $cmd = "./tmpl_process3.pl install -r " . 
35                   "-i ../../koha-tmpl/$interface-tmpl/prog/en/ " .
36                   "-o ../../koha-tmpl/$interface-tmpl/prog/$code/ " .
37                   "-s po/$_";
38         system $cmd;
39     }
40 }
41
42
43 # Main
44
45 install_code ( $_ ) foreach ( @ARGV );
46