Translations: Merge pull_from_zanata

Merge the two pull_from_zanata functions. We do not need the special
50 % rule for manuals anymore.

Change-Id: I80ed31b5d59020ece3abcfc4bd9e6f8145dd566a
This commit is contained in:
Andreas Jaeger 2015-09-22 20:22:56 +02:00
parent 56ccfa16cf
commit f40bcd2213
2 changed files with 15 additions and 32 deletions

@ -374,25 +374,7 @@ function compress_manual_po_files {
}
function pull_from_zanata {
# Since Zanata does not currently have an option to not download new
# files, we download everything, and then remove new files that are not
# translated enough.
zanata-cli -B -e pull
for i in $(find . -name '*.po' ! -path './.*' -prune | cut -b3-); do
check_po_file "$i"
if [ $RATIO -lt 75 ]; then
# This means the file is below the ratio, but we only want to
# delete it if is a new file. Files known to git that drop below
# 20% will be cleaned up by cleanup_po_files.
if ! git ls-files | grep -xq "$i"; then
rm -f "$i"
fi
fi
done
}
function pull_from_zanata_manuals {
local project=$1
# Since Zanata does not currently have an option to not download new
@ -400,9 +382,12 @@ function pull_from_zanata_manuals {
# translated enough.
zanata-cli -B -e pull
for i in $(find . -name '*.po' ! -path './.*' -prune | cut -b3-); do
# We want new files to be >75% translated. The glossary and common
# documents in openstack-manuals have that relaxed to >8%.
check_po_file "$i"
# We want new files to be >75% translated. The glossary and
# common documents in openstack-manuals have that relaxed to
# >8%.
percentage=75
if [ $project = "openstack-manuals" ]; then
case "$i" in
@ -411,14 +396,12 @@ function pull_from_zanata_manuals {
;;
esac
fi
check_po_file "$i"
if git ls-files | grep -xq "$i"; then
# Existing file, we only want to update it if it's >50% translated.
if [ $RATIO -lt 50 ]; then
git checkout "$i"
fi
else
if [ $RATIO -lt $percentage ]; then
if [ $RATIO -lt $percentage ]; then
# This means the file is below the ratio, but we only want
# to delete it, if it is a new file. Files known to git
# that drop below 20% will be cleaned up by
# cleanup_po_files.
if ! git ls-files | grep -xq "$i"; then
rm -f "$i"
fi
fi

@ -20,7 +20,7 @@ source /usr/local/jenkins/slave_scripts/common_translation_update.sh
function propose_manuals {
# Pull updated translations from Zanata.
pull_from_zanata_manuals "$PROJECT"
pull_from_zanata "$PROJECT"
# Compress downloaded po files
# Only touch glossary in openstack-manuals but not in any other
@ -72,7 +72,7 @@ function update_po_files {
function propose_python {
# Pull updated translations from Zanata
pull_from_zanata
pull_from_zanata "$PROJECT"
# Extract all messages from project, including log messages.
extract_messages
@ -120,7 +120,7 @@ function propose_python {
function propose_horizon {
# Pull updated translations from Zanata.
pull_from_zanata
pull_from_zanata "$PROJECT"
# Invoke run_tests.sh to update the po files
# Or else, "../manage.py makemessages" can be used.
@ -137,7 +137,7 @@ function propose_horizon {
function propose_django_openstack_auth {
# Pull updated translations from Zanata.
pull_from_zanata
pull_from_zanata "$PROJECT"
# Update the .pot file
extract_messages