From cac641f921d7ee42dd8739d032a687c0175d8b54 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 22 Jun 2015 19:19:11 +0200 Subject: [PATCH] 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 --- jenkins/scripts/common_translation_update.sh | 32 ++++++------------- .../propose_translation_update_horizon.sh | 4 +-- .../scripts/upstream_translation_horizon.sh | 4 +-- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/jenkins/scripts/common_translation_update.sh b/jenkins/scripts/common_translation_update.sh index 9138a26bfb..c6ac2f724f 100644 --- a/jenkins/scripts/common_translation_update.sh +++ b/jenkins/scripts/common_translation_update.sh @@ -61,21 +61,28 @@ function setup_horizon { tx set --auto-local -r ${project}.${project}-js-translations \ "${project}/locale//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//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//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//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 -} diff --git a/jenkins/scripts/propose_translation_update_horizon.sh b/jenkins/scripts/propose_translation_update_horizon.sh index 0384bd16cc..4bac98784b 100755 --- a/jenkins/scripts/propose_translation_update_horizon.sh +++ b/jenkins/scripts/propose_translation_update_horizon.sh @@ -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/* diff --git a/jenkins/scripts/upstream_translation_horizon.sh b/jenkins/scripts/upstream_translation_horizon.sh index 2aae3949de..66a119682a 100755 --- a/jenkins/scripts/upstream_translation_horizon.sh +++ b/jenkins/scripts/upstream_translation_horizon.sh @@ -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