Translations: Update horizon

Horizon uses pot files now as all other projects, adjust scripts for the
change.

Add new Javascript translation for openstack_dashboard.

Remove now unused function compress_non_en_po_files.

Change-Id: Ibd7069c68e458d655a879e552f69f7146b47abc9
Depends-On: I2ae68207994ba549b5d8e551a40a468d63e0a4bb
This commit is contained in:
Andreas Jaeger 2015-06-22 19:19:11 +02:00
parent fb8af9f7ee
commit cac641f921
3 changed files with 14 additions and 26 deletions

View File

@ -61,21 +61,28 @@ function setup_horizon {
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 \
--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/en/LC_MESSAGES/django.po \
--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/en/LC_MESSAGES/django.po \
--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
}
@ -430,22 +437,3 @@ function compress_manual_po_files {
mv "${i}.tmp" "$i"
done
}
# Reduce size of po files. This reduces the amount of content imported
# and makes for fewer imports.
# Some projects have no pot files (see function compress_po_files) but
# use the English po file as source. For these projects we should not
# touch the English po file. This way we can reconstruct the po files
# using "msgmerge EnglishPOTFILE POFILE -o COMPLETEPOFILE".
function compress_non_en_po_files {
local directory=$1
for i in $(find $directory -name *.po); do
if [[ $i =~ "/locale/en/LC_MESSAGES/" ]] ; then
continue
fi
msgattrib --translated --no-location --sort-output "$i" \
--output="${i}.tmp"
mv "${i}.tmp" "$i"
done
}

View File

@ -34,8 +34,8 @@ tx pull -f
./run_tests.sh --makemessages -V
# Compress downloaded po files
compress_non_en_po_files "horizon"
compress_non_en_po_files "openstack_dashboard"
compress_po_files "horizon"
compress_po_files "openstack_dashboard"
# Add all changed files to git
git add horizon/locale/* openstack_dashboard/locale/*

View File

@ -34,8 +34,8 @@ setup_horizon
./run_tests.sh --makemessages -V
# Add all changed files to git
git add ${PROJECT}/locale/en/LC_MESSAGES/*
git add openstack_dashboard/locale/en/LC_MESSAGES/*
git add ${PROJECT}/locale/*pot
git add openstack_dashboard/locale/*pot
if [ $(git diff --cached | egrep -v "(POT-Creation-Date|^[\+\-]#|^\+{3}|^\-{3})" | egrep -c "^[\-\+]") -gt 0 ]; then
# Push source file changes to transifex