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

(-)a/debian/scripts/koha-translate (-21 / +42 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" \
111
                    $PERL_CMD $TRANSLATE_DIR/translate install $translate_opts $lang
112
                    $PERL_CMD $TRANSLATE_DIR/translate install $translate_opts $lang
112
            fi
113
            fi
113
        else
114
        else
Lines 153-162 remove_lang() Link Here
153
        fi
154
        fi
154
155
155
        if print_installed | grep -q $lang; then
156
        if print_installed | grep -q $lang; then
156
            rm -rf $KOHA_INSTALL_DIR/opac/htdocs/opac-tmpl/prog/$lang
157
            rm -rf $KOHA_INSTALL_DIR/$OPAC_TMPL/bootstrap/$lang
157
            rm -rf $KOHA_INSTALL_DIR/opac/htdocs/opac-tmpl/ccsr/$lang
158
            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
159
        else
161
            die "Error: the selected language is not installed."
160
            die "Error: the selected language is not installed."
162
        fi
161
        fi
Lines 198-218 set_action() Link Here
198
    fi
197
    fi
199
}
198
}
200
199
201
# Global PATH variables
200
set_dev()
202
KOHA_INSTALL_DIR="/usr/share/koha"
201
{
203
KOHA_LIB_DIR="/usr/share/koha/lib"
202
    if echo $1 | egrep -q "^[^-]"; then
204
KOHA_CONF_FILE="/etc/koha/koha-conf-site.xml.in"
203
        dev=$1
205
TRANSLATE_DIR="$KOHA_INSTALL_DIR/misc/translator"
204
    else
206
PO_DIR="$TRANSLATE_DIR/po"
205
        die "Error: dev parameter with wrong instance name"
207
PERL_CMD=`which perl`
206
    fi
207
}
208
208
209
# Control variables
209
# Control variables
210
list_all=""
210
list_all=""
211
op=""
211
op=""
212
language=""
212
language=""
213
verbose="no"
213
verbose="no"
214
dev=""
214
215
215
# We accept at most 2 parameters
216
# We accept at most 4 parameters
216
[ $# -ge 1 ] && [ $# -le 4 ] || ( usage ; die "Error: wrong parameters" )
217
[ $# -ge 1 ] && [ $# -le 4 ] || ( usage ; die "Error: wrong parameters" )
217
218
218
# Read parameters
219
# Read parameters
Lines 243-248 while [ $# -gt 0 ]; do Link Here
243
        -v|--verbose)
244
        -v|--verbose)
244
            verbose="yes"
245
            verbose="yes"
245
            shift ;;
246
            shift ;;
247
        -d|--dev)
248
            if [ $# -lt 2 ]; then
249
                die "Error: dev parameter without instance"
250
            fi
251
            shift
252
            set_dev $1
253
            shift ;;
246
        -*)
254
        -*)
247
            usage
255
            usage
248
            die "Error: unknown parameter $1." ;;
256
            die "Error: unknown parameter $1." ;;
Lines 253-258 while [ $# -gt 0 ]; do Link Here
253
261
254
done
262
done
255
263
264
# Global PATH variables, optionally use alternative paths for a dev install
265
if [ "$dev" != "" ]; then adjust_paths_dev_install $dev; fi
266
KOHA_INSTALL_DIR=$KOHA_HOME
267
if [ "$DEV_INSTALL" = "" ]; then
268
    OPAC_TMPL=opac/htdocs/opac-tmpl
269
    INTRANET_TMPL=intranet/htdocs/intranet-tmpl
270
else
271
    OPAC_TMPL=koha-tmpl/opac-tmpl
272
    INTRANET_TMPL=koha-tmpl/intranet-tmpl
273
fi
274
TRANSLATE_DIR="$KOHA_INSTALL_DIR/misc/translator"
275
PO_DIR="$TRANSLATE_DIR/po"
276
PERL_CMD=`which perl`
277
256
# Process the requested actions
278
# Process the requested actions
257
case $op in
279
case $op in
258
    "help")
280
    "help")
259
- 

Return to bug 16749