[Patches] [PATCH] [SIGNED OFF 2/2] Bail out early if an invalid language is used.

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Tue Dec 13 22:05:24 NZDT 2011


From: Marc Balmer <marc at msys.ch>
Date: Sun, 11 Dec 2011 15:40:55 +0100
Subject: [PATCH] [SIGNED OFF 2/2] Bail out early if an invalid language is used.


Signed-off-by: Marc Balmer <marc at msys.ch>
---
 misc/translator/translate |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/misc/translator/translate b/misc/translator/translate
index ebd5ce5..90f2950 100755
--- a/misc/translator/translate
+++ b/misc/translator/translate
@@ -49,6 +49,10 @@ my ($cmd, $lang) = @ARGV;
 $cmd = lc $cmd;
 if ( $cmd =~ /create|install|update/ ) {
     my $installer = LangInstaller->new( $lang, $pref );
+    if ( $cmd !~ /create/ && $lang && not $lang ~~ $installer->{langs} ) {
+        print "Unsupported language: $lang\n";
+        exit;
+    }
     if ( $all ) {
         usage() if $cmd eq 'create';
         for my $lang ( @{$installer->{langs}} ) {
-- 
1.7.2.5




More information about the Patches mailing list