From b64661a8588fb15600031474366d76026cdd8d4b Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 18 Aug 2014 21:03:43 +0200 Subject: [PATCH] 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 --- doc-tools-check-languages.conf | 18 +++++++ tools/test-languages.sh | 89 ---------------------------------- tox.ini | 13 ++--- 3 files changed, 25 insertions(+), 95 deletions(-) create mode 100644 doc-tools-check-languages.conf delete mode 100755 tools/test-languages.sh diff --git a/doc-tools-check-languages.conf b/doc-tools-check-languages.conf new file mode 100644 index 00000000..fe016b23 --- /dev/null +++ b/doc-tools-check-languages.conf @@ -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" diff --git a/tools/test-languages.sh b/tools/test-languages.sh deleted file mode 100755 index c8be4aa4..00000000 --- a/tools/test-languages.sh +++ /dev/null @@ -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 diff --git a/tox.ini b/tox.ini index abc4ef72..f5e7aae1 100644 --- a/tox.ini +++ b/tox.ini @@ -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 +