[Koha-patches] [PATCH] Bug 4154 - Include preferences translation into install.pl

Frédéric Demians f.demians at tamil.fr
Fri Feb 12 07:50:46 CET 2010


---
 misc/translator/install.pl |   66 ++++++++++++++++----------------------------
 1 files changed, 24 insertions(+), 42 deletions(-)

diff --git a/misc/translator/install.pl b/misc/translator/install.pl
index ae5e4b9..b526a6c 100755
--- a/misc/translator/install.pl
+++ b/misc/translator/install.pl
@@ -2,49 +2,31 @@
 # script to update all translations
 use strict;
 use warnings;
-use lib '/home/jmf/kohaclone';
-use C4::Languages;
-# Go through the theme/module combinations we need to update.
-my $dir = "po";
-my $po;
-opendir (DIR,$dir);
-while (defined($po = readdir(DIR))) {
-    next if $po =~ /(^\.\.?$|img|fam)/;
-    $po =~  /^(.*)-i-(staff|opac).*/;
-    print "lang: $1 interface:$2\n";
-    my ($lang,$interface) = ($1,$2);
-    $interface =~ s/staff/intranet/;
-    system("mkdir ../../koha-tmpl/$interface-tmpl/prog/$lang");
-    system("./tmpl_process3.pl install -i ../../koha-tmpl/$interface-tmpl/prog/en/ -o ../../koha-tmpl/$interface-tmpl/prog/$lang -s po/$po -r");
-}
-closedir DIR;
 
-=head
-my($theme, $module) = @$spec;
-   my $pid = fork;
-   die "fork: $!\n" unless defined $pid;
-   if (!$pid) {
+# Doesn't' handle anymore 'themes' since there is no theme .po files at all
 
-      # If current directory is translator/po instead of translator,
-      # then go back to the parent
-      if ($chdir_needed_p) {
-	 chdir('..') || die "..: cd: $!\n";
-      }
-
-      # Now call tmpl_process3.pl to do the real work
-      #
-      # Traditionally, the pot file should be named PACKAGE.pot
-      # (for Koha probably something like koha_intranet_css.pot),
-      # but this is not Koha's convention.
-      #
-      my $target = "po/${theme}_${module}" . ($pot_p? ".pot": "_$lang.po");
-      rename($target, "$target~") if $pot_p;
-      exec('./tmpl_process3.pl', ($pot_p? 'create': 'update'),
-	    '-i', "../../koha-tmpl/$module-tmpl/$theme/en/",
-	    '-s', $target, '-r');
+# Get all available language codes
+opendir my $fh, "po";
+my @langs =  map { ($_) =~ /(.*)-i-opac/ } 
+    grep { $_ =~ /.*-opac-/ } readdir($fh);
+closedir DIR;
 
-      die "tmpl_process3.pl: exec: $!\n";
-   }
-   wait;
+# Map interface name to .po file suffix
+my %its = (
+    opac     => '-i-opac-t-prog-v-3002000.po',
+    intranet => '-i-staff-t-prog-v-3002000.po',
+);
+for my $lang ( @langs ) {
+    print "Language: $lang\n";
+    while ( my ($interface, $suffix) = each %its ) {
+        my $cmd = "mkdir ../../koha-tmpl/$interface-tmpl/prog/$lang";
+        system $cmd;
+        $cmd =
+            "./tmpl_process3.pl install " .
+            "-i ../../koha-tmpl/$interface-tmpl/prog/en/ " .
+            "-o ../../koha-tmpl/$interface-tmpl/prog/$lang ".
+            "-s po/$lang$suffix -r";
+        system $cmd;
+    }
+    system "./pref-trans install $lang";
 }
-=cut
-- 
1.6.4.3




More information about the Koha-patches mailing list