[i18n] Simplify common files translation for Mitaka

backport: liberty

Change-Id: I6e0c5b67f1368f5a1927c939c7db15e596182cdc
This commit is contained in:
KATO Tomoyuki 2016-05-05 09:49:08 +09:00
parent 4b2106664b
commit 8a08bbfae2
1 changed files with 25 additions and 21 deletions

View File

@ -35,23 +35,31 @@ else
NUMBER_OF_CORES=2
fi
# For Mitaka, I18n team translates install guide and networking guide.
# To minimize the translation resource, generate pot from install guide only.
# Networking guide does not use common files that is not used by install guide.
# However, use common process to keep current translation process.
# common is imported from various RST documents, but what files are
# used varies across RST documents. Thus we need an index file to include
# all files under common. To this aim, we create such document called
# 'common-work' dynamically to generate the POT file of common.
if [[ "$REPOSITORY" = "openstack-manuals" && "$DOCNAME" = "common" ]] ; then
DIRECTORY="doc/common-work"
TOPDIR="doc/"
mkdir -p $DIRECTORY/source
cp doc/common/source/conf.py $DIRECTORY/source/conf.py
ln -sf ../../common $DIRECTORY/source/common
cat <<EOF > $DIRECTORY/source/index.rst
.. toctree::
:maxdepth: 2
:glob:
common/*
EOF
# Do not generate common-rst from the whole common-rst directory.
# common-rst.pot is generated by install guide build process.
exit 0
#DIRECTORY="doc/common-work"
#TOPDIR="doc/"
#mkdir -p $DIRECTORY/source
#cp doc/common/source/conf.py $DIRECTORY/source/conf.py
#ln -sf ../../common $DIRECTORY/source/common
#cat <<EOF > $DIRECTORY/source/index.rst
#.. toctree::
# :maxdepth: 2
# :glob:
#
# common/*
#EOF
fi
# First remove the old pot file, otherwise the new file will contain
@ -70,15 +78,11 @@ fi
sphinx-build -j $NUMBER_OF_CORES -b gettext $TAG ${DIRECTORY}/source/ \
${DIRECTORY}/source/locale/
if [[ "$REPOSITORY" = "openstack-manuals" && "$DOCNAME" = "common" ]] ; then
# In case of common, we use the working directory 'common-work'.
# Copies the generated POT to common/source/locale
# and finally removes the working directory.
msgcat ${DIRECTORY}/source/locale/common.pot | \
awk '$0 !~ /^\# [a-z0-9]+$/' \
> ${TOPDIR}common/source/locale/common.pot
rm -rf $DIRECTORY
else
if [[ "$REPOSITORY" = "openstack-manuals" && "$DOCNAME" = "install-guide" ]] ; then
# save common.pot as common to translate
mv -f ${DIRECTORY}/source/locale/common.pot \
${TOPDIR}common/source/locale/common.pot
# common is translated as part of openstack-manuals, do not
# include the file in the combined tree if it exists.
rm -f ${DIRECTORY}/source/locale/common.pot