Handle translation of Install Guide and FirstApp
These documents have several variations and we need to build all of them. Fix handling of draft documents for these. Silence sphinx and msgmerge. Change-Id: Ia34dab84f51838171240f8a0b17dec5f65058fc5
This commit is contained in:
parent
1844bc2ca2
commit
eb5f3ef18f
|
@ -9,6 +9,7 @@ Release notes
|
|||
* Remove ``dn2osdbk`` and the ``hotref`` sphinx extension.
|
||||
* ``autohelp.py``: Can now find options for a project in multiple python
|
||||
packages.
|
||||
* ``doc-tools-check-languages``: Handle RST Install Guide and FirstApp.
|
||||
|
||||
0.29.1
|
||||
------
|
||||
|
|
|
@ -46,9 +46,14 @@ function build_rst {
|
|||
TAG=""
|
||||
# We need to extract all strings, so add all supported tags
|
||||
if [ ${book} = "firstapp" ] ; then
|
||||
TAG="-t libcloud -t fog"
|
||||
TAG="-t libcloud -t fog -t dotnet -t pkgcloud -t shade"
|
||||
fi
|
||||
tox -evenv "sphinx-build -W -b gettext $TAG ${DOC_DIR}${book}/source/ ${DOC_DIR}${book}/source/locale/"
|
||||
if [ ${book} = "install-guide" ] ; then
|
||||
TAG="-t obs -t rdo -t ubuntu -t debian"
|
||||
fi
|
||||
tox -evenv "sphinx-build -q -E -W -b gettext $TAG ${DOC_DIR}${book}/source/ \
|
||||
${DOC_DIR}${book}/source/locale/"
|
||||
|
||||
# Merge the common-rst po file in
|
||||
if [[ -e ${DOC_DIR}common-rst/source/locale/${language}/LC_MESSAGES/common-rst.po ]] ; then
|
||||
msgcat --use-first -o ${DOC_DIR}${book}/source/locale/${language}/${book}.po \
|
||||
|
@ -66,31 +71,55 @@ function build_rst {
|
|||
bf=$(basename $f)
|
||||
# Remove .pot
|
||||
bfname=${bf%.pot}
|
||||
msgmerge -o ${DOC_DIR}${book}/source/locale/${language}/LC_MESSAGES/${bfname}.po \
|
||||
msgmerge --silent -o ${DOC_DIR}${book}/source/locale/${language}/LC_MESSAGES/${bfname}.po \
|
||||
${DOC_DIR}${book}/source/locale/${language}/LC_MESSAGES/${book}.po \
|
||||
${DOC_DIR}${book}/source/locale/${bf}
|
||||
msgfmt ${DOC_DIR}${book}/source/locale/${language}/LC_MESSAGES/${bfname}.po \
|
||||
-o ${DOC_DIR}${book}/source/locale/${language}/LC_MESSAGES/${bfname}.mo
|
||||
done
|
||||
|
||||
# Build all books
|
||||
if [ ${book} = "firstapp" ] ; then
|
||||
tox -evenv "sphinx-build -t fog -D language=${language} \
|
||||
${DOC_DIR}${book}/source/ \
|
||||
${DOC_DIR}${book}/build-fog/html"
|
||||
mkdir -p publish-docs/${language}/firstapp-fog
|
||||
rsync -a ${DOC_DIR}firstapp/build-fog/html/ publish-docs/${language}/firstapp-fog
|
||||
tox -evenv "sphinx-build -t libcloud -D language=${language} \
|
||||
${DOC_DIR}${book}/source/ \
|
||||
${DOC_DIR}${book}/build-libcloud/html"
|
||||
mkdir -p publish-docs/${language}/firstapp-libcloud
|
||||
rsync -a ${DOC_DIR}user-guides/build-libcloud/html/ publish-docs/${language}/firstapp-libcloud/
|
||||
# Firstapp has several variations, build all of them
|
||||
for tag in libcloud dotnet fog pkgcloud shade; do
|
||||
tox -evenv "sphinx-build -q -E -t $tag -D language=${language} \
|
||||
${DOC_DIR}${book}/source/ \
|
||||
${DOC_DIR}${book}/build-${tag}/html"
|
||||
mkdir -p publish-docs/${language}/${book}-${tag}
|
||||
rsync -a ${DOC_DIR}${book}/build-${tag}/html/ \
|
||||
publish-docs/${language}/${book}-${tag}
|
||||
done
|
||||
elif [ ${book} = "install-guide" ] ; then
|
||||
# Install Guide has several variations, build all of them
|
||||
title_org=$(grep "title::" ${DOC_DIR}${book}/source/index.rst | \
|
||||
awk '{print substr($0, index($0, "::")+3)}')
|
||||
|
||||
trap "sed -i -e \"s/\.\. title::.*/.. title:: ${title_org}/\" \
|
||||
${DOC_DIR}${book}/source/index.rst" EXIT
|
||||
|
||||
for tag in obs rdo ubuntu debian; do
|
||||
title=$(grep -m 1 -A 5 ".. only:: ${tag}" \
|
||||
${DOC_DIR}${book}/source/index.rst | \
|
||||
sed -n 4p | sed -e 's/^ *//g')
|
||||
sed -i -e "s/\.\. title::.*/.. title:: ${title}/" \
|
||||
${DOC_DIR}${book}/source/index.rst
|
||||
tox -evenv "sphinx-build -q -E -t $tag -D language=${language} \
|
||||
${DOC_DIR}${book}/source/ \
|
||||
${DOC_DIR}${book}/build-${tag}/html"
|
||||
mkdir -p publish-docs/${language}/${book}-${tag}
|
||||
rsync -a ${DOC_DIR}${book}/build-${tag}/html/ \
|
||||
publish-docs/${language}/${book}-${tag}
|
||||
done
|
||||
else
|
||||
tox -evenv "sphinx-build -D language=${language} ${DOC_DIR}${book}/source/ \
|
||||
tox -evenv "sphinx-build -q -E -D language=${language} \
|
||||
${DOC_DIR}${book}/source/ \
|
||||
${DOC_DIR}${book}/build/html"
|
||||
mkdir -p publish-docs/${language}/${book}/
|
||||
rsync -a ${DOC_DIR}${book}/build/html/ publish-docs/${language}/${book}/
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function test_language {
|
||||
language=$1
|
||||
|
||||
|
@ -148,11 +177,27 @@ function handle_draft_language {
|
|||
mkdir -p publish-docs/draft/$language
|
||||
for book in ${DRAFTS["$language"]}; do
|
||||
case "${book}" in
|
||||
install-guide|config-reference)
|
||||
config-reference)
|
||||
mv publish-docs/$language/draft/$book publish-docs/draft/$language/$book
|
||||
# Remove directory if it's empty and do not fail if it's non-empty
|
||||
rmdir publish-docs/$language/draft || true
|
||||
;;
|
||||
firstapp)
|
||||
for tag in libcloud dotnet fog pkgcloud shade; do
|
||||
mv publish-docs/$language/$book-${tag} \
|
||||
publish-docs/draft/$language/$book-${tag}
|
||||
done
|
||||
# Remove directory if it's empty and do not fail if it's non-empty
|
||||
rmdir publish-docs/$language/ || true
|
||||
;;
|
||||
install-guide)
|
||||
for tag in obs rdo ubuntu debian; do
|
||||
mv publish-docs/$language/$book-${tag} \
|
||||
publish-docs/draft/$language/$book-${tag}
|
||||
done
|
||||
# Remove directory if it's empty and do not fail if it's non-empty
|
||||
rmdir publish-docs/$language/ || true
|
||||
;;
|
||||
*)
|
||||
mv publish-docs/$language/$book publish-docs/draft/$language/$book
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue