Merge "Add support for pulling translations from Zanata"

This commit is contained in:
Jenkins 2015-08-12 19:14:40 +00:00 committed by Gerrit Code Review
commit 50eaf49461
4 changed files with 81 additions and 8 deletions

View File

@ -31,6 +31,23 @@
node: 'proposal'
- job-template:
name: '{name}-propose-translation-update-zanta'
builders:
- revoke-sudo
- branch-git-prep:
branch: master
- shell: |
#!/bin/bash -xe
/usr/local/jenkins/slave_scripts/propose_translation_update.sh {name} zanata
publishers:
- console-log
- proposal-slave-cleanup
node: 'proposal'
- job:
name: 'django_openstack_auth-upstream-translation-update'
@ -64,6 +81,23 @@
node: 'proposal'
- job:
name: 'django_openstack_auth-propose-translation-update-zanata'
builders:
- revoke-sudo
- branch-git-prep:
branch: master
- shell: |
#!/bin/bash -xe
/usr/local/jenkins/slave_scripts/propose_translation_update_django_openstack_auth.sh zanata
publishers:
- console-log
- proposal-slave-cleanup
node: 'proposal'
- job:
name: 'horizon-upstream-translation-update'

View File

@ -205,10 +205,11 @@ function setup_manuals {
# Setup project so that git review works, sets global variable
# COMMIT_MSG.
function setup_review {
local TRANSLATION_SOFTWARE=${1:-Transifex}
FULL_PROJECT=$(grep project .gitreview | cut -f2 -d= |sed -e 's/\.git$//')
set +e
read -d '' COMMIT_MSG <<EOF
Imported Translations from Transifex
Imported Translations from $TRANSLATION_SOFTWARE
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure
@ -488,3 +489,18 @@ function pull_from_transifex {
# download new files.
tx pull -f
}
function pull_from_zanata {
local base_dir=$1
# Download all files that are at least 75% translated.
zanata-cli -B -e pull --min-doc-percent 75
# Work out existing locales, and only pull them. This will download
# updates for existing translations that don't meet the 75% translated
# criterion.
locales=$(ls $base_dir/locale | grep -v pot | tr '\n' ',' | sed 's/,$//')
if [ -n "$locales" ]; then
zanata-cli -B -e pull -l $locales
fi
}

View File

@ -13,6 +13,11 @@
# under the License.
PROJECT=$1
SOFTWARE="Transifex"
if [ -n "$2" -a "$2" = "zanata" ]; then
SOFTWARE="Zanata"
fi
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
@ -20,7 +25,7 @@ source /usr/local/jenkins/slave_scripts/common_translation_update.sh
setup_git
# Check whether a review already exists, setup review commit message.
setup_review
setup_review "$SOFTWARE"
# Setup basic connection for transifex.
setup_translation
# Project specific transifex setup.
@ -31,8 +36,15 @@ setup_loglevel_vars
# Project specific transifex setup for log translations.
setup_loglevel_project "$PROJECT"
# Pull updated translations from Transifex.
pull_from_transifex
# Pull updated translations from Transifex, or Zanata.
case "$SOFTWARE" in
Transifex)
pull_from_transifex
;;
Zanata)
pull_from_zanata "$PROJECT"
;;
esac
# Extract all messages from project, including log messages.
extract_messages_log "$PROJECT"

View File

@ -12,21 +12,32 @@
# License for the specific language governing permissions and limitations
# under the License.
COMMIT_MSG="Imported Translations from Transifex"
SOFTWARE="Transifex"
if [ -n "$1" -a "$1" = "zanata" ]; then
SOFTWARE="Zanata"
fi
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
setup_git
setup_review
setup_review "$SOFTWARE"
# Setup basic connection for transifex.
setup_translation
setup_django_openstack_auth
# Pull updated translations from Transifex.
pull_from_transifex
# Pull updated translations from Transifex, or Zanata.
case "$SOFTWARE" in
Transifex)
pull_from_transifex
;;
Zanata)
pull_from_zanata "openstack_auth"
;;
esac
# Update the .pot file
python setup.py extract_messages