C4/Search.pm followup auto_truncation
[koha.git] / misc / translator / update.pl
1 #!/usr/bin/perl
2 # script to update all translations
3 use strict;
4 use warnings;
5 use lib '../..';
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 =~ /^\.\.?$/;
13     print "processing $po...\n";
14     
15 #    my $interface = 'intranet';
16 #    if ($po =~ /opac/) {
17 my        $interface = 'opac';
18 #    }
19     system("./tmpl_process3.pl update -i ../../koha-tmpl/$interface-tmpl/prog/en/ -s po/$po -r");
20     print "Finished\n";
21 }
22 closedir DIR;
23
24 =head
25 my($theme, $module) = @$spec;
26    my $pid = fork;
27    die "fork: $!\n" unless defined $pid;
28    if (!$pid) {
29
30       # If current directory is translator/po instead of translator,
31       # then go back to the parent
32       if ($chdir_needed_p) {
33          chdir('..') || die "..: cd: $!\n";
34       }
35
36       # Now call tmpl_process3.pl to do the real work
37       #
38       # Traditionally, the pot file should be named PACKAGE.pot
39       # (for Koha probably something like koha_intranet_css.pot),
40       # but this is not Koha's convention.
41       #
42       my $target = "po/${theme}_${module}" . ($pot_p? ".pot": "_$lang.po");
43       rename($target, "$target~") if $pot_p;
44       exec('./tmpl_process3.pl', ($pot_p? 'create': 'update'),
45             '-i', "../../koha-tmpl/$module-tmpl/$theme/en/",
46             '-s', $target, '-r');
47
48       die "tmpl_process3.pl: exec: $!\n";
49    }
50    wait;
51 }
52 =cut