From f818b620a644400bf490cc2ee274e6cbbd7e737d Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Sat, 22 Mar 2008 20:51:25 -0400 Subject: [PATCH] Two utilities to help manage translations Signed-off-by: Joshua Ferraro --- misc/translator/install.pl | 50 ++++++++++++++++++++++++++++++++++++ misc/translator/update.pl | 52 ++++++++++++++++---------------------- 2 files changed, 72 insertions(+), 30 deletions(-) create mode 100755 misc/translator/install.pl diff --git a/misc/translator/install.pl b/misc/translator/install.pl new file mode 100755 index 0000000000..a2dcf13d42 --- /dev/null +++ b/misc/translator/install.pl @@ -0,0 +1,50 @@ +#!/usr/bin/perl +# 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 =~ /^\.\.?$/; + $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) { + + # 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'); + + die "tmpl_process3.pl: exec: $!\n"; + } + wait; +} +=cut diff --git a/misc/translator/update.pl b/misc/translator/update.pl index 6021cdff4f..8d659012d1 100755 --- a/misc/translator/update.pl +++ b/misc/translator/update.pl @@ -1,35 +1,27 @@ #!/usr/bin/perl - -# Convenience script to update two po files at once -# This emulates the GNOME "update.pl" script - +# script to update all translations use strict; -use integer; -use Getopt::Long; - -use vars qw( $pot_p ); - -GetOptions( - '--pot' => \$pot_p, -) || exit(1); - -my $lang = $ARGV[0]; -die <