View | Details | Raw Unified | Return to bug 16749
Collapse All | Expand All

(-)a/debian/scripts/koha-translate (-21 / +43 lines)
Lines 38-48 $scriptname Link Here
38
This script lets you manage your Koha templates translations.
38
This script lets you manage your Koha templates translations.
39
39
40
Usage:
40
Usage:
41
$scriptname --list|-l [--available|-a]
41
$scriptname --list|-l [--available|-a]  [-d|--dev instance]
42
$scriptname --check|-c language_code
42
$scriptname --check|-c language_code]   [-d|--dev instance]
43
$scriptname --install|-i language_code
43
$scriptname --install|-i language_code] [-d|--dev instance]
44
$scriptname --update|-u language_code
44
$scriptname --update|-u language_code]  [-d|--dev instance]
45
$scriptname --remove|-r language_code
45
$scriptname --remove|-r language_code]  [-d|--dev instance]
46
$scriptname --help|-h
46
$scriptname --help|-h
47
47
48
    -l | --list           List the installed or available (combined with -a)
48
    -l | --list           List the installed or available (combined with -a)
Lines 54-59 $scriptname --help|-h Link Here
54
    -r | --remove         Remove the specified language translations
54
    -r | --remove         Remove the specified language translations
55
    -v | --verbose        Be more verbose on the translation process
55
    -v | --verbose        Be more verbose on the translation process
56
    -h | --help           Display this help message
56
    -h | --help           Display this help message
57
    -d | --dev            Limit actions to a specific dev instance
57
58
58
EOF
59
EOF
59
}
60
}
Lines 80-87 print_available() Link Here
80
81
81
print_installed()
82
print_installed()
82
{
83
{
83
    ( ls -1 $KOHA_INSTALL_DIR/opac/htdocs/opac-tmpl/bootstrap/ ; \
84
    ( ls -1 $KOHA_INSTALL_DIR/$OPAC_TMPL/bootstrap/ ; \
84
        ls -1 $KOHA_INSTALL_DIR/opac/htdocs/opac-tmpl/prog/ 2> /dev/null ) | \
85
        ls -1 $KOHA_INSTALL_DIR/$OPAC_TMPL/prog/ 2> /dev/null ) | \
85
        sort | uniq | \
86
        sort | uniq | \
86
        grep -v -e images -e itemtypeimg -x -e en -e css -e js -e less -e lib
87
        grep -v -e images -e itemtypeimg -x -e en -e css -e js -e less -e lib
87
}
88
}
Lines 107-113 install_lang() Link Here
107
            else
108
            else
108
                # Check po files are present
109
                # Check po files are present
109
                check_lang_po_files $lang
110
                check_lang_po_files $lang
110
                env PERL5LIB="$KOHA_LIB_DIR:$TRANSLATE_DIR" KOHA_CONF="$KOHA_CONF_FILE"\
111
                env PERL5LIB="$PERL5DIR:$TRANSLATE_DIR" \
112
                    KOHA_CONF="$KOHA_CONF" \
111
                    $PERL_CMD $TRANSLATE_DIR/translate install $translate_opts $lang
113
                    $PERL_CMD $TRANSLATE_DIR/translate install $translate_opts $lang
112
            fi
114
            fi
113
        else
115
        else
Lines 153-162 remove_lang() Link Here
153
        fi
155
        fi
154
156
155
        if print_installed | grep -q $lang; then
157
        if print_installed | grep -q $lang; then
156
            rm -rf $KOHA_INSTALL_DIR/opac/htdocs/opac-tmpl/prog/$lang
158
            rm -rf $KOHA_INSTALL_DIR/$OPAC_TMPL/bootstrap/$lang
157
            rm -rf $KOHA_INSTALL_DIR/opac/htdocs/opac-tmpl/ccsr/$lang
159
            rm -rf $KOHA_INSTALL_DIR/$INTRANET_TMPL/prog/$lang
158
            rm -rf $KOHA_INSTALL_DIR/opac/htdocs/opac-tmpl/bootstrap/$lang
159
            rm -rf $KOHA_INSTALL_DIR/intranet/htdocs/intranet-tmpl/prog/$lang
160
        else
160
        else
161
            die "Error: the selected language is not installed."
161
            die "Error: the selected language is not installed."
162
        fi
162
        fi
Lines 198-218 set_action() Link Here
198
    fi
198
    fi
199
}
199
}
200
200
201
# Global PATH variables
201
set_dev()
202
KOHA_INSTALL_DIR="/usr/share/koha"
202
{
203
KOHA_LIB_DIR="/usr/share/koha/lib"
203
    if echo $1 | egrep -q "^[^-]"; then
204
KOHA_CONF_FILE="/etc/koha/koha-conf-site.xml.in"
204
        dev=$1
205
TRANSLATE_DIR="$KOHA_INSTALL_DIR/misc/translator"
205
    else
206
PO_DIR="$TRANSLATE_DIR/po"
206
        die "Error: dev parameter with wrong instance name"
207
PERL_CMD=`which perl`
207
    fi
208
}
208
209
209
# Control variables
210
# Control variables
210
list_all=""
211
list_all=""
211
op=""
212
op=""
212
language=""
213
language=""
213
verbose="no"
214
verbose="no"
215
dev=""
214
216
215
# We accept at most 2 parameters
217
# We accept at most 4 parameters
216
[ $# -ge 1 ] && [ $# -le 4 ] || ( usage ; die "Error: wrong parameters" )
218
[ $# -ge 1 ] && [ $# -le 4 ] || ( usage ; die "Error: wrong parameters" )
217
219
218
# Read parameters
220
# Read parameters
Lines 243-248 while [ $# -gt 0 ]; do Link Here
243
        -v|--verbose)
245
        -v|--verbose)
244
            verbose="yes"
246
            verbose="yes"
245
            shift ;;
247
            shift ;;
248
        -d|--dev)
249
            if [ $# -lt 2 ]; then
250
                die "Error: dev parameter without instance"
251
            fi
252
            shift
253
            set_dev $1
254
            shift ;;
246
        -*)
255
        -*)
247
            usage
256
            usage
248
            die "Error: unknown parameter $1." ;;
257
            die "Error: unknown parameter $1." ;;
Lines 253-258 while [ $# -gt 0 ]; do Link Here
253
262
254
done
263
done
255
264
265
# Global PATH variables, optionally use alternative paths for a dev install
266
if [ "$dev" != "" ]; then adjust_paths_dev_install $dev; fi
267
KOHA_INSTALL_DIR=$KOHA_HOME
268
if [ "$DEV_INSTALL" = "" ]; then
269
    OPAC_TMPL=opac/htdocs/opac-tmpl
270
    INTRANET_TMPL=intranet/htdocs/intranet-tmpl
271
else
272
    OPAC_TMPL=koha-tmpl/opac-tmpl
273
    INTRANET_TMPL=koha-tmpl/intranet-tmpl
274
fi
275
TRANSLATE_DIR="$KOHA_INSTALL_DIR/misc/translator"
276
PO_DIR="$TRANSLATE_DIR/po"
277
PERL_CMD=`which perl`
278
256
# Process the requested actions
279
# Process the requested actions
257
case $op in
280
case $op in
258
    "help")
281
    "help")
259
- 

Return to bug 16749