@@ -, +, @@ template translations $ koha-translate --update - Have a koha-common setup with some languages installed (e.g. koha-translate --install es-ES) - Apply the patch and build a package for it. - Install it. - A new AUTOMATIC_TRANSLATIONS_UPDATE config variable should be in place at /etc/default/koha-common - Set AUTOMATIC_TRANSLATIONS_UPDATE to 'yes' - Re-install the package to trigger the post-install script - Verify that translations get updated. --- debian/koha-common.default | 13 +++++++++++++ debian/koha-common.postinst | 25 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) --- a/debian/koha-common.default +++ a/debian/koha-common.default @@ -1,3 +1,16 @@ ## General koha-common default options PERL5LIB="/usr/share/koha/lib" + +## Automatic template translation update +# +# This variable controls whether template translations should +# be updated automatically on koha-common package upgrades. +# Options: 'yes' +# 'no' (default) +# Note: if you choose 'no' then you will have to issue +# $ koha-translate --update +# +#AUTOMATIC_TRANSLATIONS_UPDATE="no" + +## End of general koha-common default options --- a/debian/koha-common.postinst +++ a/debian/koha-common.postinst @@ -2,8 +2,20 @@ set -e +NAME="koha-common" +AUTOMATIC_TRANSLATIONS_UPDATE='no' + . /usr/share/debconf/confmodule +# Read configuration variable file if it is present +if [ -r /etc/default/$NAME ]; then + # Debian / Ubuntu + . /etc/default/$NAME +elif [ -r /etc/sysconfig/$NAME ]; then + # RedHat / SuSE + . /etc/sysconfig/$NAME +fi + conf=/etc/mysql/koha-common.cnf if [ ! -e "$conf" ] && [ ! -L "$conf" ] then @@ -14,6 +26,19 @@ fi koha-upgrade-schema $(koha-list) +if [ "$AUTOMATIC_TRANSLATIONS_UPDATE" = "yes" ]; then + for lang in $(koha-translate --list | grep -v -x "en"); do + if koha-translate --update $lang; then + echo "Updated the $lang translations." + else + cat <