Remove usage of transifex client

Remove all invocations of transifex client "tx".

This removes also the script populate-zanata-project.sh that is not
needed anymore, since we have switch to Zanata and started translating
there. The script is broken with the removal of "tx" support in other
places and not needed anymore.

Change-Id: I74350c92da425a6bf32ea1debd217a531dc2f400
This commit is contained in:
Andreas Jaeger 2015-09-18 21:29:59 +02:00
parent bec0a1f5ea
commit 0f78e7bf19
10 changed files with 2 additions and 163 deletions

@ -19,33 +19,10 @@ source /usr/local/jenkins/slave_scripts/common.sh
# Used for setup.py babel commands
QUIET="--quiet"
# Initial transifex setup
function setup_translation {
# Track in HAS_CONFIG whether we run "tx init" since calling it
# will add the file .tx/config - and "tx set" might update it. If
# "tx set" updates .tx/config, we need to handle the file if it
# existed before.
HAS_CONFIG=1
# Initialize the transifex client, if there's no .tx directory
if [ ! -d .tx ] ; then
tx init --host=https://www.transifex.com
HAS_CONFIG=0
fi
}
# Setup a project for transifex or Zanata
# Setup a project for Zanata
function setup_project {
local project=$1
# Transifex project name does not include "."
tx_project=${project/\./}
tx set --auto-local -r ${tx_project}.${tx_project}-translations \
"${project}/locale/<lang>/LC_MESSAGES/${project}.po" \
--source-lang en \
--source-file ${project}/locale/${project}.pot -t PO \
--execute
/usr/local/jenkins/slave_scripts/create-zanata-xml.py -p $project \
-v master --srcdir ${project}/locale --txdir ${project}/locale \
-f zanata.xml
@ -55,34 +32,6 @@ function setup_project {
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/djangojs.pot \
-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/django.pot \
-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/django.pot \
-t PO --execute
# OpenStack Dashboard JavaScript Translations
tx set --auto-local -r ${project}.openstack-dashboard-js-translations \
"openstack_dashboard/locale/<lang>/LC_MESSAGES/djangojs.po" \
--source-lang en \
--source-file openstack_dashboard/locale/djangojs.pot \
-t PO --execute
/usr/local/jenkins/slave_scripts/create-zanata-xml.py -p $project \
-v master --srcdir . --txdir . -r './horizon/locale/*.pot' \
'horizon/locale/{locale_with_underscore}/LC_MESSAGES/{filename}.po' \
@ -156,13 +105,6 @@ function setup_manuals {
if [ ${IS_RST} -eq 1 ] ; then
tox -e generatepot-rst -- ${DOCNAME}
git add ${DocFolder}/${DOCNAME}/source/locale/${DOCNAME}.pot
# Set auto-local
tx set --auto-local -r openstack-manuals-i18n.${DOCNAME} \
"${DocFolder}/${DOCNAME}/source/locale/<lang>/LC_MESSAGES/${DOCNAME}.po" \
--source-lang en \
--source-file ${DocFolder}/${DOCNAME}/source/locale/${DOCNAME}.pot \
--minimum-perc=$PERC \
-t PO --execute
ZANATA_RULES="$ZANATA_RULES -r ${ZanataDocFolder}/${DOCNAME}/source/locale/${DOCNAME}.pot ${DocFolder}/${DOCNAME}/source/locale/{locale_with_underscore}/LC_MESSAGES/${DOCNAME}.po"
else
# Update the .pot file
@ -175,12 +117,6 @@ function setup_manuals {
if [ -f ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ]; then
# Add all changed files to git
git add ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot
# Set auto-local
tx set --auto-local -r openstack-manuals-i18n.${SLUG} \
"${DocFolder}/${DOCNAME}/locale/<lang>.po" --source-lang en \
--source-file ${DocFolder}/${DOCNAME}/locale/${DOCNAME}.pot \
--minimum-perc=$PERC \
-t PO --execute
ZANATA_RULES="$ZANATA_RULES -r ${ZanataDocFolder}/${DOCNAME}/locale/${DOCNAME}.pot ${DocFolder}/${DOCNAME}/locale/{locale_with_underscore}.po"
fi
fi
@ -256,13 +192,6 @@ EOF
# Propose patch using COMMIT_MSG
function send_patch {
# Revert any changes done to .tx/config
if [ $HAS_CONFIG -eq 1 ]; then
git reset -q .tx/config
git checkout -- .tx/config
else
rm -rf .tx
fi
# We don't have any repos storing zanata.xml, so just remove it.
rm -f zanata.xml
@ -289,27 +218,6 @@ function setup_loglevel_vars {
LKEYWORD['critical']='_LC'
}
# Setup transifex configuration for log level message translation.
# Needs variables setup via setup_loglevel_vars.
function setup_loglevel_project {
project=$1
# Transifex project name does not include "."
tx_project=${project/\./}
for level in $LEVELS ; do
# Bootstrapping: Create file if it does not exist yet,
# otherwise "tx set" will fail.
if [ ! -e ${project}/locale/${project}-log-${level}.pot ]; then
touch ${project}/locale/${project}-log-${level}.pot
fi
tx set --auto-local -r ${tx_project}.${tx_project}-log-${level}-translations \
"${project}/locale/<lang>/LC_MESSAGES/${project}-log-${level}.po" \
--source-lang en \
--source-file ${project}/locale/${project}-log-${level}.pot -t PO \
--execute
done
}
# Run extract_messages for user visible messages and log messages.
# Needs variables setup via setup_loglevel_vars.
@ -329,11 +237,6 @@ function extract_messages_log {
# Setup project django_openstack_auth for transifex and Zanata
function setup_django_openstack_auth {
tx set --auto-local -r horizon.djangopo \
"openstack_auth/locale/<lang>/LC_MESSAGES/django.po" \
--source-lang en \
--source-file openstack_auth/locale/openstack_auth.pot -t PO \
--execute
/usr/local/jenkins/slave_scripts/create-zanata-xml.py \
-p django_openstack_auth -v master --srcdir openstack_auth/locale \

@ -1,50 +0,0 @@
#!/bin/bash -xe
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
PROJECT=$1
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
setup_translation
case "$PROJECT" in
api-site|ha-guide|openstack-manuals|operations-guide|security-doc|\
training-guides)
init_manuals "$PROJECT"
setup_manuals "$PROJECT"
;;
django_openstack_auth)
setup_django_openstack_auth
;;
horizon)
setup_horizon
;;
*)
setup_project "$PROJECT"
setup_loglevel_vars
setup_loglevel_project "$PROJECT"
;;
esac
# Download all files from transifex
tx pull -a -f --minimum-perc=0
# Grab any new translations that may have been made in zanata
zanata-cli -B -e pull
# And upload them to Zanata
zanata-cli -B -e push --push-type both
# Undo everything we did locally
git reset --hard

@ -21,15 +21,11 @@ setup_git
# Check whether a review already exists, setup review commit message.
setup_review
# Setup basic connection for transifex.
setup_translation
# Project specific transifex setup.
# Project specific setup.
setup_project "$PROJECT"
# Setup some global vars which will be used in the rest of the script.
setup_loglevel_vars
# Project specific transifex setup for log translations.
setup_loglevel_project "$PROJECT"
# Pull updated translations from Zanata
pull_from_zanata

@ -18,9 +18,6 @@ setup_git
setup_review
# Setup basic connection for transifex.
setup_translation
setup_django_openstack_auth
# Pull updated translations from Zanata.

@ -17,7 +17,6 @@ source /usr/local/jenkins/slave_scripts/common_translation_update.sh
setup_git
setup_review
setup_translation
setup_horizon
# Pull updated translations from Zanata.

@ -25,7 +25,6 @@ init_manuals "$PROJECT"
setup_git
setup_review
setup_translation
setup_manuals "$PROJECT"

@ -23,7 +23,6 @@ fi
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
setup_git
setup_translation
setup_django_openstack_auth

@ -25,7 +25,6 @@ fi
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
setup_git
setup_translation
setup_horizon

@ -21,11 +21,9 @@ fi
source /usr/local/jenkins/slave_scripts/common_translation_update.sh
setup_git
setup_translation
setup_project "$PROJECT"
setup_loglevel_vars
setup_loglevel_project "$PROJECT"
extract_messages_log "$PROJECT"

@ -27,7 +27,6 @@ source /usr/local/jenkins/slave_scripts/common_translation_update.sh
init_manuals "$PROJECT"
setup_git
setup_translation
setup_manuals "$PROJECT"