From 9ee5653f2161c45e368cffc15180672e287b7384 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Fri, 24 Apr 2015 08:24:14 +0200 Subject: [PATCH] Fix translation compress for manuals Not all manual repositories have a doc directory, adjust the paths. Not all files should be compressed, we need to exclude in all repositories - besides openstack-manuals - the glossary. Change-Id: I358db42585699b05e893b66e1ac6d2927fb43ee3 --- jenkins/scripts/common_translation_update.sh | 20 +++++++++++++++++++ .../propose_translation_update_manuals.sh | 20 ++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/jenkins/scripts/common_translation_update.sh b/jenkins/scripts/common_translation_update.sh index 260e7b2d56..8622351cce 100644 --- a/jenkins/scripts/common_translation_update.sh +++ b/jenkins/scripts/common_translation_update.sh @@ -389,3 +389,23 @@ function compress_po_files { mv "${i}.tmp" "$i" done } + +# Reduce size of po files. This reduces the amount of content imported +# and makes for fewer imports. +# This does not touch the pot files. This way we can reconstruct the po files +# using "msgmerge POTFILE POFILE -o COMPLETEPOFILE". +# Give directory name to not touch files for example under .tox. +# Pass glossary flag to not touch the glossary. +function compress_manual_po_files { + local directory=$1 + local glossary=$2 + for i in `find $directory -name *.po `; do + if [ "$glossary" -eq "0" ] ; then + if [[ $i =~ "/glossary/" ]] ; then + continue + fi + fi + msgattrib --translated --no-location "$i" --output="${i}.tmp" + mv "${i}.tmp" "$i" + done +} diff --git a/jenkins/scripts/propose_translation_update_manuals.sh b/jenkins/scripts/propose_translation_update_manuals.sh index 97c5397cc0..bef136748c 100755 --- a/jenkins/scripts/propose_translation_update_manuals.sh +++ b/jenkins/scripts/propose_translation_update_manuals.sh @@ -42,7 +42,25 @@ tx pull -a -f tx pull -f --minimum-perc=50 # Compress downloaded po files -compress_po_files "doc" +# Only touch glossary in openstack-manuals but not in any other +# repository. +case "$project" in + openstack-manuals) + compress_manual_po_files "doc" 1 + ;; + api-site) + compress_manual_po_files "api-ref-guides" 0 + compress_manual_po_files "api-quick-start" 0 + compress_manual_po_files "api-ref" 0 + compress_manual_po_files "openstack-firstapp" 0 + ;; + ha-guide|operations-guide) + compress_manual_po_files "doc" 0 + ;; + security-doc) + compress_manual_po_files "security-guide" 0 + ;; +esac # Add imported upstream translations to git for FILE in ${DocFolder}/*; do