Setup for translation

Setup the same way the other repos are setup.

Note that currently no jobs are run since training-guides has no
localization. But let's keep the setup in sync.

Change-Id: I7e9ced06c3ad9997d7f790a5a4d507fa13ef0490
This commit is contained in:
Andreas Jaeger 2014-08-18 21:03:43 +02:00
parent 5a31467dbc
commit b64661a858
3 changed files with 25 additions and 95 deletions

View File

@ -0,0 +1,18 @@
# Example configuration for the language 'ja'
# Directories to set up
declare -A DIRECTORIES=(
["ja"]="training-guides"
)
# Books to build
declare -A BOOKS=(
["ja"]="training-guides"
)
# Where does the top-level pom live?
# Set to empty to not copy it.
POM_FILE=""
# Location of doc dir
DOC_DIR="doc"

View File

@ -1,89 +0,0 @@
#!/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

13
tox.ini
View File

@ -51,8 +51,8 @@ commands =
# in the venv. Since it's installed in the system, let's
# use sitepackages.
sitepackages=True
whitelist_externals = bash
commands = bash tools/test-languages.sh test all
whitelist_externals = doc-tools-check-languages
commands = doc-tools-check-languages doc-tools-check-languages.conf test all
[testenv:buildlang]
# Run as "tox -e buildlang -- $LANG"
@ -60,13 +60,14 @@ commands = bash tools/test-languages.sh test all
# in the venv. Since it's installed in the system, let's
# use sitepackages.
sitepackages=True
whitelist_externals = bash
commands = bash tools/test-languages.sh test all
whitelist_externals = doc-tools-check-languages
commands = doc-tools-check-languages doc-tools-check-languages.conf test {posargs}
[testenv:publishlang]
# Generatedocbook needs xml2po which cannot be installed
# in the venv. Since it's installed in the system, let's
# use sitepackages.
sitepackages=True
whitelist_externals = bash
commands = bash tools/test-languages.sh publish all
whitelist_externals = doc-tools-check-languages
commands = doc-tools-check-languages doc-tools-check-languages.conf test all