Merge "Translations: Merge pull_from_zanata"

This commit is contained in:
Jenkins 2015-09-25 18:49:05 +00:00 committed by Gerrit Code Review
commit 463a2458ef
2 changed files with 15 additions and 32 deletions

View File

@ -385,25 +385,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
@ -411,9 +393,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
@ -422,14 +407,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

View File

@ -24,7 +24,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
@ -76,7 +76,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
@ -124,7 +124,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.
@ -141,7 +141,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