6 AUTOMATIC_TRANSLATIONS_UPDATE="yes"
8 . /usr/share/debconf/confmodule
10 # Read configuration variable file if it is present
11 CONFIG=/etc/koha/koha-common.conf
12 if [ -r $CONFIG ]; then
16 conf=/etc/mysql/koha-common.cnf
17 if [ ! -e "$conf" ] && [ ! -L "$conf" ]
19 ln -s debian.cnf "$conf"
24 koha-upgrade-schema $(koha-list)
26 # Generate a config file if one doesn't exist already
27 if [ ! -e $CONFIG ]; then
29 ## Automatic template translation update
31 # This variable controls whether template translations should
32 # be updated automatically on koha-common package upgrades.
33 # Options: 'yes' (default)
35 # Note: if you choose 'no' then you will have to issue
36 # $ koha-translate --update <lang_code>
38 AUTOMATIC_TRANSLATIONS_UPDATE="yes"
42 # Substitute the values from debconf into the file.
43 db_get koha-common/automatically-update-translations
45 if [ "$UPDATE" = "false" ]; then
50 # In case they were removed/commented out, we add it in.
51 grep -Eq '^ *AUTOMATIC_TRANSLATIONS_UPDATE=' $CONFIG || \
52 echo "AUTOMATIC_TRANSLATIONS_UPDATE=" >> $CONFIG
54 sed -e "s/^ *AUTOMATIC_TRANSLATIONS_UPDATE=.*/AUTOMATIC_TRANSLATIONS_UPDATE=\"$UPDATE\"/" < $CONFIG > $CONFIG.tmp
55 mv -f $CONFIG.tmp $CONFIG
57 if [ "$AUTOMATIC_TRANSLATIONS_UPDATE" = "yes" ]; then
58 for lang in $(koha-translate --list | grep -v -x "en"); do
59 if koha-translate --update $lang; then
60 echo "Updated the $lang translations."
63 ERROR: an error was found when updating '$lang' translations. Please manually
64 run 'koha-translate --update $lang'. Run man koha-translate for more options.
69 # no auto-update, check update needed and warn if needed
70 if koha-translate --list | grep -v -q -x "en"; then
71 # translations installed, update needed
73 Warning: template translations are not set to be automatically updated.
74 Please manually run 'koha-translate --update lang_code' to update them.
76 You can run 'koha-translate --list' to get a list of the installed translations codes.