diff --git a/modules/openstack_project/files/slave_scripts/common_translation_update.sh b/modules/openstack_project/files/slave_scripts/common_translation_update.sh index f3befd53de..a83e33cee7 100644 --- a/modules/openstack_project/files/slave_scripts/common_translation_update.sh +++ b/modules/openstack_project/files/slave_scripts/common_translation_update.sh @@ -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/.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 () { diff --git a/modules/openstack_project/files/slave_scripts/propose_translation_update_manuals.sh b/modules/openstack_project/files/slave_scripts/propose_translation_update_manuals.sh index b903544dd2..e8ec37667a 100755 --- a/modules/openstack_project/files/slave_scripts/propose_translation_update_manuals.sh +++ b/modules/openstack_project/files/slave_scripts/propose_translation_update_manuals.sh @@ -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/.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}/} diff --git a/modules/openstack_project/files/slave_scripts/upstream_translation_update_manuals.sh b/modules/openstack_project/files/slave_scripts/upstream_translation_update_manuals.sh index a6afb8f944..3468a67feb 100755 --- a/modules/openstack_project/files/slave_scripts/upstream_translation_update_manuals.sh +++ b/modules/openstack_project/files/slave_scripts/upstream_translation_update_manuals.sh @@ -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/.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