Merge "Fix translation setup for api-site"

This commit is contained in:
Jenkins 2014-06-02 14:28:10 +00:00 committed by Gerrit Code Review
commit 8c12b9c6a9
3 changed files with 52 additions and 45 deletions

View File

@ -63,6 +63,51 @@ function setup_horizon ()
-t PO --execute
}
# Set global variable DocFolder for manuals projects
function init_manuals ()
{
project=$1
DocFolder="doc"
if [ $project = "api-site" ] ; then
DocFolder="./"
fi
}
# Setup project manuals projects (api-site, openstack-manuals,
# operations-guide) for transifex
function setup_manuals ()
{
# Generate pot one by one
for FILE in ${DocFolder}/*
do
# Skip non-directories
if [ ! -d $FILE ]
then
continue
fi
DOCNAME=${FILE#${DocFolder}/}
# Ignore directories that will not get translated
if [ "$DOCNAME" == "www" -o "$DOCNAME" == "tools" -o "$DOCNAME" == "generated" -o "$DOCNAME" == "publish-docs" ]
then
continue
fi
# Update the .pot file
./tools/generatepot ${DOCNAME}
if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]
then
# Add all changed files to git
git add ${DocFolder}/${DOCNAME}/locale/*
# Set auto-local
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
"${DocFolder}/${DOCNAME}/locale/<lang>.po" --source-lang en \
--source-file ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot \
-t PO --execute
fi
done
}
# Setup git so that git review works
function setup_git ()
{

View File

@ -20,34 +20,15 @@
ORG="openstack"
PROJECT=$1
DocFolder="doc"
if [ $PROJECT = "api-site" ] ; then
DocFolder="./"
fi
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
init_manuals "$PROJECT"
setup_git
setup_review "$ORG" "$PROJECT"
setup_translation
# Generate pot one by one
for FILE in ${DocFolder}/*
do
DOCNAME=${FILE#${DocFolder}/}
# Update the .pot file
./tools/generatepot ${DOCNAME}
if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]
then
# Add all changed files to git
git add ${DocFolder}/${DOCNAME}/locale/*
# Set auto-local
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
"${DocFolder}/${DOCNAME}/locale/<lang>.po" --source-lang en \
--source-file ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot \
-t PO --execute
fi
done
setup_manuals
# Pull upstream translations of files that are at least 75 %
# translated
@ -61,7 +42,7 @@ if [ $PROJECT = "openstack-manuals" ] ; then
tx pull -f --minimum-perc=8 -r openstack-manuals-i18n.common
fi
# Add imported upstream translations to git
for FILE in ${DocFolder}/*
do
DOCNAME=${FILE#${DocFolder}/}

View File

@ -18,11 +18,6 @@
PROJECT=$1
DocFolder="doc"
if [ $PROJECT = "api-site" ] ; then
DocFolder="./"
fi
if [ ! `echo $ZUUL_REFNAME | grep master` ]
then
exit 0
@ -30,26 +25,12 @@ fi
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
init_manuals "$PROJECT"
setup_git
setup_translation
# Generate pot one by one
for FILE in ${DocFolder}/*
do
DOCNAME=${FILE#${DocFolder}/}
# Update the .pot file
./tools/generatepot ${DOCNAME}
if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]
then
# Add all changed files to git
git add ${DocFolder}/${DOCNAME}/locale/*
# Set auto-local
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
"${DocFolder}/${DOCNAME}/locale/<lang>.po" --source-lang en \
--source-file ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot \
-t PO --execute
fi
done
setup_manuals
if [ ! `git diff --cached --quiet HEAD --` ]
then