Handle empty PO files

Some projects like oslo.messaging and oslo.reports have now empty PO
files. Pushing empty files to transifex results in an error.

Check before pushing of the main file whether it's empty and only
push if it's non-empty - like it's done for the log-level PO
files already.

Change-Id: Ia757e9d4b88bc8eb7b1ce800a25fe0ed1ebe3e76
This commit is contained in:
Andreas Jaeger 2015-08-26 14:52:00 +02:00
parent 2f94bc3576
commit 152efbc3bc

View File

@ -37,7 +37,14 @@ if ! git diff-index --quiet HEAD --; then
# Transifex project name does not include "."
tx_project=${PROJECT/\./}
tx --debug --traceback push -s -r ${tx_project}.${tx_project}-translations
# Only push if there is actual content in the file. We check
# that the file contains at least one non-empty msgid string.
if grep -q 'msgid "[^"]' ${PROJECT}/locale/${PROJECT}.pot ; then
tx --debug --traceback push -s \
-r ${tx_project}.${tx_project}-translations
fi
for level in $LEVELS ; do
# Only push if there is actual content in the file. We check
# that the file contains at least one non-empty msgid string.