diff --git a/jenkins/scripts/common_translation_update.sh b/jenkins/scripts/common_translation_update.sh index 8622351cce..98c5514549 100644 --- a/jenkins/scripts/common_translation_update.sh +++ b/jenkins/scripts/common_translation_update.sh @@ -409,3 +409,21 @@ 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 "$i" --output="${i}.tmp" + mv "${i}.tmp" "$i" + done +} diff --git a/jenkins/scripts/propose_translation_update_django_openstack_auth.sh b/jenkins/scripts/propose_translation_update_django_openstack_auth.sh index cd169e53b1..ffb408bbea 100755 --- a/jenkins/scripts/propose_translation_update_django_openstack_auth.sh +++ b/jenkins/scripts/propose_translation_update_django_openstack_auth.sh @@ -39,6 +39,9 @@ if [ -n "$PO_FILES" ]; then python setup.py update_catalog --no-fuzzy-matching --ignore-obsolete=true fi +# Compress downloaded po files +compress_po_files "openstack_auth" + # Add all changed files to git git add openstack_auth/locale/* diff --git a/jenkins/scripts/propose_translation_update_horizon.sh b/jenkins/scripts/propose_translation_update_horizon.sh index c98ff856fe..0384bd16cc 100755 --- a/jenkins/scripts/propose_translation_update_horizon.sh +++ b/jenkins/scripts/propose_translation_update_horizon.sh @@ -33,6 +33,10 @@ tx pull -f # Or else, "../manage.py makemessages" can be used. ./run_tests.sh --makemessages -V +# Compress downloaded po files +compress_non_en_po_files "horizon" +compress_non_en_po_files "openstack_dashboard" + # Add all changed files to git git add horizon/locale/* openstack_dashboard/locale/*