Bug 10896: Add a --verbose option to koha-translate

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>
This commit is contained in:
Tomas Cohen Arazi 2014-01-06 10:52:38 -03:00 committed by Galen Charlton
parent 5920ca6fa0
commit cfc3ce6772
2 changed files with 22 additions and 4 deletions

View 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>
@ -73,6 +75,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>

View File

@ -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." ;;