Ignore empty log translation source files

We do not need to store any empty source translation files in git or in
Zanata. There are many empty LOG source translation files, so let's
remove them.

Note we always keep the "main" files, the "main" files should always
have content.

The change tests after generation of LOG source translation files
whether these are empty and deletes them from filesystem and git.

Change-Id: I0957c66fca5aa5ded93c858766a4c0a93f963032
This commit is contained in:
Andreas Jaeger 2015-09-27 11:26:28 +02:00
parent 18471b569f
commit 3e7931bef3

@ -234,13 +234,23 @@ function extract_messages {
# Run extract_messages for log messages.
# Needs variables setup via setup_loglevel_vars.
function extract_messages_log {
project=$1
local project=$1
local POT
local trans
# Update the .pot files
for level in $LEVELS ; do
POT=${project}/locale/${project}-log-${level}.pot
python setup.py $QUIET extract_messages --no-default-keywords \
--keyword ${LKEYWORD[$level]} \
--output-file ${project}/locale/${project}-log-${level}.pot
--output-file ${POT}
# We don't need to add or send around empty source files.
trans=$(msgfmt --statistics -o /dev/null ${POT} 2>&1)
if [ "$trans" = "0 translated messages." ] ; then
rm $POT
# Remove file from git if it's under version control.
git rm --ignore-unmatch $POT
fi
done
}