training-guides/tools/test-languages.sh
Andreas Jaeger a970b5104e Setup training-guides for translation
Note that this does not build any translated guides yet since we do not
have the guides translated properly into any language.

This infrastructure is needed to enable the translations.

Change-Id: I2accb7e713ed88a3e06edca31bb7691d2d0bc14c
2014-07-08 22:08:20 +02:00

90 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
function setup_directory {
SET_LANG=$1
shift
for BOOK_DIR in "$@" ; do
echo " $BOOK_DIR"
openstack-generate-docbook -l $SET_LANG -b $BOOK_DIR
done
}
function setup_lang {
SET_LANG=$1
shift
echo "Setting up files for $SET_LANG"
echo "======================="
echo " Directories:"
setup_directory $SET_LANG "$@"
}
function test_ja {
setup_lang 'ja'
setup_directory 'ja' 'training-guides'
case "$PURPOSE" in
test)
openstack-doc-test -v --check-build -l ja
RET=$?
;;
publish)
openstack-doc-test -v --publish --check-build -l ja
RET=$?
;;
esac
if [ "$RET" -eq "0" ] ; then
echo "... succeeded"
else
echo "... failed"
BUILD_FAIL=1
fi
}
function test_language () {
case "$language" in
all)
# Currently no language added since there's nothing
# translated yet. Japenese is just shown as an example.
;;
ja)
test_ja
;;
*)
BUILD_FAIL=1
echo "Language $language not handled"
;;
esac
}
function usage () {
echo "Call the script as: "
echo "$0 PURPOSE LANGUAGE1 LANGUAGE2..."
echo "PURPOSE is either 'test' or 'publish'."
echo "LANGUAGE can also be 'all'."
}
if [ "$#" -lt 2 ] ; then
usage
exit 1
fi
if [ "$1" = "test" ] ; then
PURPOSE="test"
elif [ "$1" = "publish" ] ; then
PURPOSE="publish"
else
usage
exit 1
fi
shift
BUILD_FAIL=0
for language in "$@" ; do
echo
echo "Building for language $language"
echo
test_language "$language"
done
exit $BUILD_FAIL