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

(-)a/debian/scripts/koha-translate (-21 / +57 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_HOME/$OPAC_TMPL/bootstrap/ ; \
84
        ls -1 $KOHA_INSTALL_DIR/opac/htdocs/opac-tmpl/prog/ 2> /dev/null ) | \
85
        ls -1 $KOHA_HOME/$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="$PERL5LIB:$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_HOME/$OPAC_TMPL/bootstrap/$lang
157
            rm -rf $KOHA_INSTALL_DIR/opac/htdocs/opac-tmpl/ccsr/$lang
159
            rm -rf $KOHA_HOME/$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
}
209
210
check_koha_conf()
211
{
212
    if [ "$dev" != "" ]; then
213
        KOHA_CONF=/etc/koha/sites/$dev/koha-conf.xml
214
    elif [ -z $KOHA_CONF ]; then
215
        KOHA_CONF=/etc/koha/koha-conf-site.xml.in
216
    fi
217
}
218
219
init_template_paths()
220
{
221
    # Template paths
222
    if [ "$dev" != "" ]; then
223
        OPAC_TMPL=opac/htdocs/opac-tmpl
224
        INTRANET_TMPL=intranet/htdocs/intranet-tmpl
225
    else
226
        OPAC_TMPL=koha-tmpl/opac-tmpl
227
        INTRANET_TMPL=koha-tmpl/intranet-tmpl
228
    fi
229
    TRANSLATE_DIR="$KOHA_HOME/misc/translator"
230
    PO_DIR="$TRANSLATE_DIR/po"
231
}
208
232
209
# Control variables
233
# Control variables
210
list_all=""
234
list_all=""
211
op=""
235
op=""
212
language=""
236
language=""
213
verbose="no"
237
verbose="no"
238
dev=""
214
239
215
# We accept at most 2 parameters
240
# We accept at most 4 parameters
216
[ $# -ge 1 ] && [ $# -le 4 ] || ( usage ; die "Error: wrong parameters" )
241
[ $# -ge 1 ] && [ $# -le 4 ] || ( usage ; die "Error: wrong parameters" )
217
242
218
# Read parameters
243
# Read parameters
Lines 243-248 while [ $# -gt 0 ]; do Link Here
243
        -v|--verbose)
268
        -v|--verbose)
244
            verbose="yes"
269
            verbose="yes"
245
            shift ;;
270
            shift ;;
271
        -d|--dev)
272
            if [ $# -lt 2 ]; then
273
                die "Error: dev parameter without instance"
274
            fi
275
            shift
276
            set_dev $1
277
            shift ;;
246
        -*)
278
        -*)
247
            usage
279
            usage
248
            die "Error: unknown parameter $1." ;;
280
            die "Error: unknown parameter $1." ;;
Lines 253-258 while [ $# -gt 0 ]; do Link Here
253
285
254
done
286
done
255
287
288
if [ "$dev" != "" ]; then adjust_paths_dev_install $dev
289
check_koha_conf
290
init_template_paths
291
PERL_CMD=`which perl`
292
256
# Process the requested actions
293
# Process the requested actions
257
case $op in
294
case $op in
258
    "help")
295
    "help")
259
- 

Return to bug 16749