[Koha-patches] [PATCH] Bug 5506 Improve translations script

Frédéric Demians f.demians at tamil.fr
Wed Dec 15 17:20:24 CET 2010


Add the ability to run:

  translate update

in order to update all .po file at once.
---
 misc/translator/LangInstaller.pm |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm
index a1fef0f..6f64246 100644
--- a/misc/translator/LangInstaller.pm
+++ b/misc/translator/LangInstaller.pm
@@ -347,11 +347,23 @@ sub install {
 }
 
 
+sub get_all_langs {
+    my $self = shift;
+    opendir( my $dh, $self->{path_po} );
+    map { $_ =~ s/-i-opac-t-prog-v-3002000.po$//; $_ }
+        grep { $_ =~ /-i-opac-t-prog-v-3002000.po$/ }
+            readdir $dh;
+}
+
+
 sub update {
     my $self = shift;
-    return unless $self->{lang};
-    $self->update_tmpl() unless $self->{pref_only};
-    $self->update_prefs();
+    my @langs = $self->{lang} ? ($self->{lang}) : $self->get_all_langs();
+    for my $lang ( @langs ) {
+        $self->{lang} = $lang;
+        $self->update_tmpl() unless $self->{pref_only};
+        $self->update_prefs();
+    }
 }
 
 
-- 
1.7.3.2



More information about the Koha-patches mailing list