Add support for pulling translations from Zanata
To help move to Zanata, we should pull down translations from the server. Add a function that should behave the same way as the existing Transifex function, as well as changing two existing scripts to call it based on a command-line parameter. Add two new jobs with a -zanata suffix so we can switch projects one at a time. This change deals with all of the Python projects and django_openstack_auth. Horizon and OpenStack manuals will be dealt with in a future patch. Change-Id: I8003ac37aeb89d59ceeba2e75eed2f8100b82367
This commit is contained in:
parent
5b2e9fd547
commit
3ca25f7204
@ -31,6 +31,23 @@
|
|||||||
|
|
||||||
node: 'proposal'
|
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:
|
- job:
|
||||||
name: 'django_openstack_auth-upstream-translation-update'
|
name: 'django_openstack_auth-upstream-translation-update'
|
||||||
|
|
||||||
@ -64,6 +81,23 @@
|
|||||||
|
|
||||||
node: 'proposal'
|
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:
|
- job:
|
||||||
name: 'horizon-upstream-translation-update'
|
name: 'horizon-upstream-translation-update'
|
||||||
|
|
||||||
|
@ -200,10 +200,11 @@ function setup_manuals {
|
|||||||
# Setup project so that git review works, sets global variable
|
# Setup project so that git review works, sets global variable
|
||||||
# COMMIT_MSG.
|
# COMMIT_MSG.
|
||||||
function setup_review {
|
function setup_review {
|
||||||
|
local TRANSLATION_SOFTWARE=${1:-Transifex}
|
||||||
FULL_PROJECT=$(grep project .gitreview | cut -f2 -d= |sed -e 's/\.git$//')
|
FULL_PROJECT=$(grep project .gitreview | cut -f2 -d= |sed -e 's/\.git$//')
|
||||||
set +e
|
set +e
|
||||||
read -d '' COMMIT_MSG <<EOF
|
read -d '' COMMIT_MSG <<EOF
|
||||||
Imported Translations from Transifex
|
Imported Translations from $TRANSLATION_SOFTWARE
|
||||||
|
|
||||||
For more information about this automatic import see:
|
For more information about this automatic import see:
|
||||||
https://wiki.openstack.org/wiki/Translations/Infrastructure
|
https://wiki.openstack.org/wiki/Translations/Infrastructure
|
||||||
@ -481,3 +482,18 @@ function pull_from_transifex {
|
|||||||
# download new files.
|
# download new files.
|
||||||
tx pull -f
|
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
|
||||||
|
}
|
||||||
|
@ -13,6 +13,11 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
PROJECT=$1
|
PROJECT=$1
|
||||||
|
SOFTWARE="Transifex"
|
||||||
|
|
||||||
|
if [ -n "$2" -a "$2" = "zanata" ]; then
|
||||||
|
SOFTWARE="Zanata"
|
||||||
|
fi
|
||||||
|
|
||||||
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
|
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
|
setup_git
|
||||||
|
|
||||||
# Check whether a review already exists, setup review commit message.
|
# Check whether a review already exists, setup review commit message.
|
||||||
setup_review
|
setup_review "$SOFTWARE"
|
||||||
# Setup basic connection for transifex.
|
# Setup basic connection for transifex.
|
||||||
setup_translation
|
setup_translation
|
||||||
# Project specific transifex setup.
|
# Project specific transifex setup.
|
||||||
@ -31,8 +36,15 @@ setup_loglevel_vars
|
|||||||
# Project specific transifex setup for log translations.
|
# Project specific transifex setup for log translations.
|
||||||
setup_loglevel_project "$PROJECT"
|
setup_loglevel_project "$PROJECT"
|
||||||
|
|
||||||
# Pull updated translations from Transifex.
|
# Pull updated translations from Transifex, or Zanata.
|
||||||
pull_from_transifex
|
case "$SOFTWARE" in
|
||||||
|
Transifex)
|
||||||
|
pull_from_transifex
|
||||||
|
;;
|
||||||
|
Zanata)
|
||||||
|
pull_from_zanata "$PROJECT"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Extract all messages from project, including log messages.
|
# Extract all messages from project, including log messages.
|
||||||
extract_messages_log "$PROJECT"
|
extract_messages_log "$PROJECT"
|
||||||
|
@ -12,21 +12,32 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# 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
|
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
|
||||||
|
|
||||||
setup_git
|
setup_git
|
||||||
|
|
||||||
setup_review
|
setup_review "$SOFTWARE"
|
||||||
|
|
||||||
# Setup basic connection for transifex.
|
# Setup basic connection for transifex.
|
||||||
setup_translation
|
setup_translation
|
||||||
|
|
||||||
setup_django_openstack_auth
|
setup_django_openstack_auth
|
||||||
|
|
||||||
# Pull updated translations from Transifex.
|
# Pull updated translations from Transifex, or Zanata.
|
||||||
pull_from_transifex
|
case "$SOFTWARE" in
|
||||||
|
Transifex)
|
||||||
|
pull_from_transifex
|
||||||
|
;;
|
||||||
|
Zanata)
|
||||||
|
pull_from_zanata "openstack_auth"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Update the .pot file
|
# Update the .pot file
|
||||||
python setup.py extract_messages
|
python setup.py extract_messages
|
||||||
|
Loading…
Reference in New Issue
Block a user