Remove translation of log level variables

The i18n team decided to not translate the log level files anymore,
remove support for them and remove the files from repositories.

Only remove files from master, not from released stable branches.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html

Change-Id: I91ed824a90eb9b8a3b36866a2120083559668d0f
This commit is contained in:
Andreas Jaeger 2016-11-02 19:33:49 +01:00
parent d53fffa9b4
commit d53e2d3e51
3 changed files with 27 additions and 28 deletions

View File

@ -294,17 +294,6 @@ EOF
return $success
}
# Setup global variables LEVELS and LKEYWORDS
function setup_loglevel_vars {
# Strings for various log levels
LEVELS="info warning error critical"
# Keywords for each log level:
declare -g -A LKEYWORD
LKEYWORD['info']='_LI'
LKEYWORD['warning']='_LW'
LKEYWORD['error']='_LE'
LKEYWORD['critical']='_LC'
}
# Delete empty pot files
function check_empty_pot {
@ -320,7 +309,6 @@ function check_empty_pot {
}
# Run extract_messages for python projects.
# Needs variables setup via setup_loglevel_vars.
function extract_messages_python {
local modulename=$1
@ -341,18 +329,6 @@ function extract_messages_python {
-k "_C:1c,2" -k "_P:1,2" \
-o ${pot} ${modulename}
check_empty_pot ${pot}
# Update the log level .pot files
for level in $LEVELS ; do
pot=${modulename}/locale/${modulename}-log-${level}.pot
$VENV/bin/pybabel ${QUIET} extract --no-default-keywords \
--add-comments Translators: \
--msgid-bugs-address="https://bugs.launchpad.net/openstack-i18n/" \
--project=${PROJECT} --version=${VERSION} \
-k ${LKEYWORD[$level]} \
-o ${pot} ${modulename}
check_empty_pot ${pot}
done
}
# Django projects need horizon installed for extraction, install it in
@ -523,6 +499,25 @@ function cleanup_po_files {
done
}
# Remove obsolete log lovel files. We have added them in the past but
# do not translate them anymore, so let's eventually remove them.
function cleanup_log_files {
local modulename=$1
local levels="info warning error critical"
for i in $(find $modulename -name *.po) ; do
# We do not store the log level files anymore, remove them
# from git.
local bi=$(basename $i)
for level in $levels ; do
if [[ "$bi" == "$modulename-log-$level.po" ]] ; then
git rm -f --ignore-unmatch $i
fi
done
done
}
# Remove all pot files, we publish them to
# http://tarballs.openstack.org/translation-source/{name}/VERSION ,

View File

@ -88,6 +88,7 @@ function propose_training_guides {
# Propose updates for python and django projects
function propose_python_django {
local modulename=$1
local version=$2
# Check for empty directory and exit early
local content=$(ls -A $modulename/locale/)
@ -103,6 +104,11 @@ function propose_python_django {
# Cleanup po and pot files
cleanup_module "$modulename"
if [ "$version" == "master" ] ; then
# Remove not anymore translated log files on master, but not
# on released stable branches.
cleanup_log_files "$modulename"
fi
# Check first whether directory exists, it might be missing if
# there are no translations.
@ -140,11 +146,11 @@ function handle_python_django {
extract_messages_django "$modulename"
;;
python)
# Extract all messages from project, including log messages.
# Extract messages from project except log messages
extract_messages_python "$modulename"
;;
esac
propose_python_django "$modulename"
propose_python_django "$modulename" "$ZANATA_VERSION"
done
fi
}
@ -204,7 +210,6 @@ case "$PROJECT" in
;;
*)
# Common setup for python and django repositories
setup_loglevel_vars
handle_python_django $PROJECT python
handle_python_django $PROJECT django
;;

View File

@ -74,7 +74,6 @@ case "$PROJECT" in
module_names=$(get_modulename $PROJECT python)
if [ -n "$module_names" ]; then
setup_project "$PROJECT" "$ZANATA_VERSION" $module_names
setup_loglevel_vars
if [[ "$ZANATA_VERSION" == "master" && -f releasenotes/source/conf.py ]]; then
extract_messages_releasenotes
ALL_MODULES="releasenotes $ALL_MODULES"