Decrease PO files for imports (horizon+friends)

Remove untranslated strings and location information from PO files
for horizon and django_openstack_auth. For horizon, the
location information is still in the English PO files as reference for easy
regeneration using "msgmerge EnglishPOFILE POFILE -o COMPLETEPOFILE".

Change-Id: Ibb440320e0fd882c86ff79ec295411c3d062a521
This commit is contained in:
Andreas Jaeger 2015-04-23 20:52:44 +02:00
parent edd6e518b5
commit c294627405
3 changed files with 25 additions and 0 deletions

View File

@ -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
}

View File

@ -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/*

View File

@ -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/*