Support translation of RST files
The OpenStack manuals are switching to some RST files. Enhance our scripts so that they can handle RST files in manual projects. Change-Id: Ie3e9591d2aad88aced3092aa2a8919af186ce83d Depends-On: I3124cf65b254c1c5aefce59447bb94240d96a742
This commit is contained in:
parent
59db4150c9
commit
e8e61d6107
@ -82,6 +82,11 @@ function init_manuals {
|
|||||||
# operations-guide) for transifex
|
# operations-guide) for transifex
|
||||||
function setup_manuals {
|
function setup_manuals {
|
||||||
local project=$1
|
local project=$1
|
||||||
|
|
||||||
|
# Fill in associative array SPECIAL_BOOKS
|
||||||
|
declare -A SPECIAL_BOOKS
|
||||||
|
source doc-tools-check-languages.conf
|
||||||
|
|
||||||
# Generate pot one by one
|
# Generate pot one by one
|
||||||
for FILE in ${DocFolder}/*; do
|
for FILE in ${DocFolder}/*; do
|
||||||
# Skip non-directories
|
# Skip non-directories
|
||||||
@ -93,10 +98,6 @@ function setup_manuals {
|
|||||||
if [[ "$DOCNAME" =~ ^(www|tools|generated|publish-docs)$ ]]; then
|
if [[ "$DOCNAME" =~ ^(www|tools|generated|publish-docs)$ ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
# Ignore directories starting with playground
|
|
||||||
if [[ "$DOCNAME" =~ "^playground" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
# Skip glossary in all repos besides openstack-manuals.
|
# Skip glossary in all repos besides openstack-manuals.
|
||||||
if [ "$project" != "openstack-manuals" -a "$DOCNAME" == "glossary" ]; then
|
if [ "$project" != "openstack-manuals" -a "$DOCNAME" == "glossary" ]; then
|
||||||
continue
|
continue
|
||||||
@ -113,11 +114,31 @@ function setup_manuals {
|
|||||||
PERC=8
|
PERC=8
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
IS_RST=0
|
||||||
|
if [ ${SPECIAL_BOOKS["${DOCNAME}"]+_} ] ; then
|
||||||
|
if [ ${SPECIAL_BOOKS["${DOCNAME}"]} == "RST" ] ; then
|
||||||
|
IS_RST=1
|
||||||
|
fi
|
||||||
|
if [ ${SPECIAL_BOOKS["${DOCNAME}"]} == "skip" ] ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ${IS_RST} -eq 1 ] ; then
|
||||||
|
tox -e generatepot-rst -- ${DOCNAME}
|
||||||
|
git add ${DocFolder}/${DOCNAME}/source/locale/${DOCNAME}.pot
|
||||||
|
# Set auto-local
|
||||||
|
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
||||||
|
"${DocFolder}/${DOCNAME}/source/locale/<lang>/LC_MESSAGES/${DOCNAME}.po" \
|
||||||
|
--source-lang en \
|
||||||
|
--source-file ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot \
|
||||||
|
--minimum-perc=$PERC \
|
||||||
|
-t PO --execute
|
||||||
|
else
|
||||||
# Update the .pot file
|
# Update the .pot file
|
||||||
./tools/generatepot ${DOCNAME}
|
./tools/generatepot ${DOCNAME}
|
||||||
if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]; then
|
if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]; then
|
||||||
# Add all changed files to git
|
# Add all changed files to git
|
||||||
git add ${DocFolder}/${DOCNAME}/locale/*
|
git add ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot
|
||||||
# Set auto-local
|
# Set auto-local
|
||||||
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
|
||||||
"${DocFolder}/${DOCNAME}/locale/<lang>.po" --source-lang en \
|
"${DocFolder}/${DOCNAME}/locale/<lang>.po" --source-lang en \
|
||||||
@ -125,6 +146,7 @@ function setup_manuals {
|
|||||||
--minimum-perc=$PERC \
|
--minimum-perc=$PERC \
|
||||||
-t PO --execute
|
-t PO --execute
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,9 @@ for FILE in ${DocFolder}/*; do
|
|||||||
if [ -d ${DocFolder}/${DOCNAME}/locale ] ; then
|
if [ -d ${DocFolder}/${DOCNAME}/locale ] ; then
|
||||||
git add ${DocFolder}/${DOCNAME}/locale/*
|
git add ${DocFolder}/${DOCNAME}/locale/*
|
||||||
fi
|
fi
|
||||||
|
if [ -d ${DocFolder}/${DOCNAME}/source/locale ] ; then
|
||||||
|
git add ${DocFolder}/${DOCNAME}/source/locale/*
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
filter_commits
|
filter_commits
|
||||||
|
Loading…
Reference in New Issue
Block a user