openstack-manuals/tools/generatepot-rst.sh
daisy-ycguo 670c7af1ad First step for translation of RST files
Set locale_dirs in conf.py to support translated documents building.
Add a config variable SPECIAL_BOOKS to list documents in RST format.
Add new generatepot-rst tox environment to generate all pot file,
invoke using "tox -e generatepot-rst -- playground-user-guide".

Add new script to generate the pot files.

Co-Authored-By: Andreas Jaeger <aj@suse.de>

Change-Id: I3124cf65b254c1c5aefce59447bb94240d96a742
2015-03-06 21:31:01 +01:00

33 lines
1.1 KiB
Bash
Executable File

#!/bin/bash -xe
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Copy files from trunk to named branch and replace all links from
# trunk with links to the branch
DOCNAME=$1
if [ -z "$DOCNAME" ] ; then
echo "usage $0 DOCNAME"
exit 1
fi
sphinx-build -b gettext doc/$DOCNAME/source/ doc/$DOCNAME/source/locale/
# Take care of deleting all temporary files so that git add
# doc/$DOCNAME/source/locale will only add the single pot file.
msgcat doc/$DOCNAME/source/locale/*.pot > doc/$DOCNAME/source/DOCNAME.pot
rm doc/$DOCNAME/source/locale/*.pot
mv doc/$DOCNAME/source/DOCNAME.pot doc/$DOCNAME/source/locale/DOCNAME.pot