Merge "[translation] doc generatepot jobs for 3 projects"

This commit is contained in:
Zuul 2018-06-26 10:30:03 +00:00 committed by Gerrit Code Review
commit c41eb578d8
4 changed files with 60 additions and 0 deletions

View File

@ -5121,6 +5121,8 @@
description: Repository containing OpenStack repositories
- project: openstack/openstack-ansible
description: Ansible playbooks for deploying OpenStack.
options:
- translate
- project: openstack/openstack-ansible-apt_package_pinning
description: Role apt_package_pinning for OpenStack-Ansible
groups:
@ -5480,6 +5482,8 @@
- openstack-helm
description: Helm charts for deploying OpenStack on Kubernetes
use-storyboard: true
options:
- translate
- project: openstack/openstack-helm-addons
use-storyboard: true
groups:

View File

@ -417,6 +417,51 @@ function extract_messages_django {
done
}
# Extract doc messages
function extract_messages_doc {
# Temporary build folder for gettext
mkdir -p doc/build/gettext
# Extract messages
sphinx-build -b gettext doc/source \
doc/build/gettext/
# Manipulates pot translation sources if needed
if [[ -f tools/doc-pot-filter.sh ]]; then
tools/doc-pot-filter.sh
fi
# New translation target projects may not have locale folder
mkdir -p doc/source/locale
# Sphinx builds a pot file for each directory and for each file
# in the top-level directory.
# We keep the directory files and concatenate all top-level files.
local has_other=0
for f in doc/build/gettext/*.pot; do
local fn=$(basename $f .pot)
# If a pot file corresponds to a directory, we use the pot file as-is.
if [ -d doc/source/$fn ]; then
# Remove UUIDs, those are not necessary and change too often
msgcat --use-first --sort-by-file $f | \
awk '$0 !~ /^\# [a-z0-9]+$/' > doc/source/locale/doc-$fn.pot
rm $f
else
has_other=1
fi
done
# We concatenate remaining into a single pot file so that
# "git add ${DIRECTORY}/source/locale" will only add a
# single pot file for all top-level files.
if [ "$has_other" = "1" ]; then
# Remove UUIDs, those are not necessary and change too often
msgcat --use-first --sort-by-file doc/build/gettext/*.pot | \
awk '$0 !~ /^\# [a-z0-9]+$/' > doc/source/locale/doc.pot
fi
rm -rf doc/build/gettext/
}
# Extract releasenotes messages
function extract_messages_releasenotes {
local keep_workdir=$1

View File

@ -114,6 +114,15 @@ case "$PROJECT" in
ALL_MODULES="$modulename $ALL_MODULES"
done
fi
# ---- Documentation ----
# Let's test this with some repos :)
DOC_TARGETS=('horizon' 'openstack-ansible' 'openstack-helm')
if [[ -f doc/source/conf.py ]]; then
if [[ ${DOC_TARGETS[*]} =~ "$PROJECT" ]]; then
extract_messages_doc
ALL_MODULES="doc $ALL_MODULES"
fi
fi
;;
esac

View File

@ -11047,6 +11047,7 @@
- publish-openstack-sphinx-docs
- deploy-guide-jobs
- release-notes-jobs
- translation-jobs
release:
jobs:
- announce-release
@ -11660,6 +11661,7 @@
templates:
- system-required
- publish-openstack-sphinx-docs
- translation-jobs
- project:
name: openstack/openstack-helm-addons