[Koha-patches] [PATCH] Bug 10896: Add a --verbose option to koha-translate

Tomas Cohen Arazi tomascohen at gmail.com
Thu Jan 9 20:03:29 CET 2014


The -v and --verbose option switches add the --verbose switch to the
misc/translator/translate script call in the packages' 'koha-translate'
command.

The docs are updated accordingly.

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba
---
 debian/docs/koha-translate.xml | 10 +++++++++-
 debian/scripts/koha-translate  | 16 +++++++++++++---
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/debian/docs/koha-translate.xml b/debian/docs/koha-translate.xml
index e06dede..588aa59 100644
--- a/debian/docs/koha-translate.xml
+++ b/debian/docs/koha-translate.xml
@@ -23,7 +23,9 @@
 
   <refsynopsisdiv>
     <cmdsynopsis>
-      <command>koha-translate</command> <arg><option>-i</option>|<option>--install</option></arg> <arg><option>-u</option>|<option>--update</option></arg> <arg><option>-r</option>|<option>--remove</option></arg> <arg><option>-c</option>|<option>--check</option></arg> <arg choice="req"  rep="norepeat"><replaceable>lang_code</replaceable></arg>
+      <command>koha-translate</command> <arg><option>-i</option>|<option>--install</option></arg> <arg><option>-u</option>|<option>--update</option></arg> <arg><option>-r</option>|<option>--remove</option></arg> <arg><option>-c</option>|<option>--check</option></arg> <arg><option>-v</option>|<option>--verbose</option></arg> <arg choice="req"  rep="norepeat"><replaceable>lang_code</replaceable></arg>
+    </cmdsynopsis>
+    <cmdsynopsis>
       <command>koha-translate</command> <arg><option>-l</option>|<option>--list</option></arg> <arg><option>-a</option>|<option>--available</option></arg>
     </cmdsynopsis>
   </refsynopsisdiv>
@@ -66,6 +68,12 @@
         <para>Update the specified lang_code language translation.</para>
       </listitem>
     </varlistentry>
+    <varlistentry>
+      <term><option>-v, --verbose</option></term>
+      <listitem>
+        <para>Be more verbose on the translation process.</para>
+      </listitem>
+    </varlistentry>
 
  </variablelist>
   </refsect1>
diff --git a/debian/scripts/koha-translate b/debian/scripts/koha-translate
index 0c731cf..c579a7b 100755
--- a/debian/scripts/koha-translate
+++ b/debian/scripts/koha-translate
@@ -44,6 +44,7 @@ $scriptname -h
     -i | --install        Install the specified language translations
     -u | --update         Update the specified language translations
     -r | --remove         Remove the specified language translations
+    -v | --verbose        Be more verbose on the translation process
     -h | --help           Display this help message
 
 EOF
@@ -82,7 +83,12 @@ print_installed()
 
 install_lang()
 {
-    lang=$1
+    local lang=$1
+    local translate_opts=""
+
+    if [ "$verbose" = "yes" ]; then
+        translate_opts="--verbose"
+    fi
 
     if [ "$lang" != "" ]; then
 
@@ -97,7 +103,7 @@ install_lang()
                 # Check po files are present
                 check_lang_po_files $lang
                 env PERL5LIB="$KOHA_LIB_DIR:$TRANSLATE_DIR" KOHA_CONF="$KOHA_CONF_FILE"\
-                    $PERL_CMD $TRANSLATE_DIR/translate install $lang
+                    $PERL_CMD $TRANSLATE_DIR/translate install $translate_opts $lang
             fi
         else
             die "Error: the selected language is not currently available."
@@ -195,9 +201,10 @@ PERL_CMD=`which perl`
 list_all=""
 op=""
 language=""
+verbose="no"
 
 # We accept at most 2 parameters
-[ $# -ge 1 ] && [ $# -le 3 ] || ( usage ; die "Error: wrong parameters" )
+[ $# -ge 1 ] && [ $# -le 4 ] || ( usage ; die "Error: wrong parameters" )
 
 # Read parameters
 while [ $# -gt 0 ]; do
@@ -224,6 +231,9 @@ while [ $# -gt 0 ]; do
         -a|--available)
             list_all=1
             shift ;;
+        -v|--verbose)
+            verbose="yes"
+            shift ;;
         -*)
             usage
             die "Error: unknown parameter $1." ;;
-- 
1.8.3.2



More information about the Koha-patches mailing list