Commit df854aab authored by bgm's avatar bgm Committed by L10n scripts on biryani

bin/compile-mo-files-extensions.sh: do not try to compile if the source .pot file is empty.

Normally this should not be necessary, since we only compile if there are some
translations available (.po files), but it is a quick check and can avoid some
weirdness.
parent 2f0f5602
......@@ -50,12 +50,28 @@ function compile_po () {
function compile_po_for_ext () {
ext=$1
langs=`ls -1d po/$ext/??_??`
for lang in $langs; do
l=`basename $lang`
compile_po $ext $l
done
# Skip empty source .pot files
# Ex: check if "po/example/pot/example.pot" has a non-zero size.
# This can happen when extensions do not have any ts() strings in them.
if [ ! -s "po/$ext/pot/$ext.pot" ]; then
echo "skipping $ext, po/$ext/pot/$ext.pot is empty."
return
fi
# Check if there are translations for the extensions.
# This can happen if the extension has no strings, or was not sent to Transifex.
# http://stackoverflow.com/questions/6363441/check-if-a-file-exists-with-wildcard-in-shell-script
if ls po/$ext/??_?? &> /dev/null ; then
langs=`ls -1d po/$ext/??_??`
for lang in $langs; do
l=`basename $lang`
compile_po $ext $l
done
else
echo "** $ext has no translations (probably no strings in the ext)."
fi
}
if [ "$1" = "--help" -o "$1" = "-h" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment