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
This commit is contained in:
Andreas Jaeger 2015-04-24 08:24:14 +02:00
parent 06d413a78d
commit 9ee5653f21
2 changed files with 39 additions and 1 deletions

View File

@ -389,3 +389,23 @@ function compress_po_files {
mv "${i}.tmp" "$i" mv "${i}.tmp" "$i"
done 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
}

View File

@ -42,7 +42,25 @@ tx pull -a -f
tx pull -f --minimum-perc=50 tx pull -f --minimum-perc=50
# Compress downloaded po files # 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 # Add imported upstream translations to git
for FILE in ${DocFolder}/*; do for FILE in ${DocFolder}/*; do