Bug 10896: Add a --verbose option to koha-translate
authorTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 6 Jan 2014 13:52:38 +0000 (10:52 -0300)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 13 Jan 2014 20:57:04 +0000 (20:57 +0000)
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.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Works as expected with and without -v. Man page looks good.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
debian/docs/koha-translate.xml
debian/scripts/koha-translate

index 7f97e8e..c64ae15 100644 (file)
@@ -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>
       <command>koha-translate</command> <arg><option>-h</option>|<option>--help</option></arg>
     </cmdsynopsis>
         <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>
index d0b3a2f..78bc23e 100755 (executable)
@@ -44,6 +44,7 @@ $scriptname --help|-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." ;;