Remove duplication in translation scripts

Remove now obsolete setting of COMMIT_MSG, it's done in
common_translation_update.

Move common horizon transifex setup to new function setup_horizon.

Use local for some variables.

Change-Id: Ia5fe641a38a110aec937304603412afaa571134c
This commit is contained in:
Andreas Jaeger 2014-05-28 13:30:21 +02:00
parent f98ad18c66
commit 7bd6a4e532
5 changed files with 32 additions and 33 deletions

View File

@ -27,7 +27,7 @@ function setup_translation ()
# Setup a project for transifex
function setup_project ()
{
project=$1
local project=$1
tx set --auto-local -r ${project}.${project}-translations \
"${project}/locale/<lang>/LC_MESSAGES/${project}.po" \
@ -36,6 +36,33 @@ function setup_project ()
--execute
}
# Setup project horizon for transifex
function setup_horizon ()
{
local project=horizon
# Horizon JavaScript Translations
tx set --auto-local -r ${project}.${project}-js-translations \
"${project}/locale/<lang>/LC_MESSAGES/djangojs.po" \
--source-lang en \
--source-file ${project}/locale/en/LC_MESSAGES/djangojs.po \
-t PO --execute
# Horizon Translations
tx set --auto-local -r ${project}.${project}-translations \
"${project}/locale/<lang>/LC_MESSAGES/django.po" \
--source-lang en \
--source-file ${project}/locale/en/LC_MESSAGES/django.po \
-t PO --execute
# OpenStack Dashboard Translations
tx set --auto-local -r ${project}.openstack-dashboard-translations \
"openstack_dashboard/locale/<lang>/LC_MESSAGES/django.po" \
--source-lang en \
--source-file openstack_dashboard/locale/en/LC_MESSAGES/django.po \
-t PO --execute
}
# Setup git so that git review works
function setup_git ()
{
@ -48,8 +75,8 @@ function setup_git ()
# COMMIT_MSG.
function setup_review ()
{
ORG="$1"
PROJECT="$2"
local ORG="$1"
local PROJECT="$2"
COMMIT_MSG="Imported Translations from Transifex"

View File

@ -14,7 +14,6 @@
ORG=$1
PROJECT=$2
COMMIT_MSG="Imported Translations from Transifex"
source /usr/local/jenkins/slave_scripts/common_translation_update.sh

View File

@ -14,7 +14,6 @@
ORG=openstack
PROJECT=horizon
COMMIT_MSG="Imported Translations from Transifex"
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
@ -22,19 +21,7 @@ setup_git
setup_review "$ORG" "$PROJECT"
setup_translation
# Horizon JavaScript Translations
tx set --auto-local -r ${PROJECT}.${PROJECT}-js-translations \
"${PROJECT}/locale/<lang>/LC_MESSAGES/djangojs.po" --source-lang en \
--source-file ${PROJECT}/locale/en/LC_MESSAGES/djangojs.po -t PO --execute
# Horizon Translations
tx set --auto-local -r ${PROJECT}.${PROJECT}-translations \
"${PROJECT}/locale/<lang>/LC_MESSAGES/django.po" --source-lang en \
--source-file ${PROJECT}/locale/en/LC_MESSAGES/django.po -t PO --execute
# OpenStack Dashboard Translations
tx set --auto-local -r ${PROJECT}.openstack-dashboard-translations \
"openstack_dashboard/locale/<lang>/LC_MESSAGES/django.po" --source-lang en \
--source-file openstack_dashboard/locale/en/LC_MESSAGES/django.po -t PO --execute
setup_horizon
# Pull upstream translations of files that are at least 75 %
# translated

View File

@ -25,8 +25,6 @@ if [ $PROJECT = "api-site" ] ; then
DocFolder="./"
fi
COMMIT_MSG="Imported Translations from Transifex"
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
setup_git

View File

@ -28,18 +28,7 @@ source /usr/local/jenkins/slave_scripts/common_translation_update.sh
setup_git
setup_translation
# Horizon JavaScript Translations
tx set --auto-local -r ${PROJECT}.${PROJECT}-js-translations \
"${PROJECT}/locale/<lang>/LC_MESSAGES/djangojs.po" --source-lang en \
--source-file ${PROJECT}/locale/en/LC_MESSAGES/djangojs.po -t PO --execute
# Horizon Translations
tx set --auto-local -r ${PROJECT}.${PROJECT}-translations \
"${PROJECT}/locale/<lang>/LC_MESSAGES/django.po" --source-lang en \
--source-file ${PROJECT}/locale/en/LC_MESSAGES/django.po -t PO --execute
# OpenStack Dashboard Translations
tx set --auto-local -r ${PROJECT}.openstack-dashboard-translations \
"openstack_dashboard/locale/<lang>/LC_MESSAGES/django.po" --source-lang en \
--source-file openstack_dashboard/locale/en/LC_MESSAGES/django.po -t PO --execute
setup_horizon
# Invoke run_tests.sh to update the po files
# Or else, "../manage.py makemessages" can be used.
@ -54,4 +43,3 @@ then
# Push source file changes to transifex
tx --debug --traceback push -s
fi