1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 15:19:44 +02:00

locale/diagnostics.sh emits CSV format; detects even one omission

This commit is contained in:
Paul Licameli 2021-06-09 11:03:19 -04:00
parent 2c81d53355
commit a4f2fb549e

View File

@ -5,22 +5,25 @@
# How many messages in total?
total=`grep '^msgid' audacity.pot | wc -l`
#CSV header
echo "Name,Completed,Pct. completed,Bad lines"
declare -i badlines
for filename in `ls *.po`; do
# If there are errors from msgcmp, then the last line on standard error
# contains a count of problematic messages; else it won't match the
# pattern in awk, so assume no errors
errors=`msgcmp $filename audacity.pot 2>&1 | \
awk '/msgcmp: found [0-9]* fatal errors/ { nn = $3 } END {print 0+nn}'`
awk '/msgcmp: found [0-9]* fatal error/ { nn = $3 } END {print 0+nn}'`
complete=$((total-errors))
# A few spaces after the filename makes the columns mostly aligned
echo "${filename} " $'\t' $complete $'\t' "$((complete*100/total)) %"
done | sort -n -k3
echo
# detect whether this sequence occurs in any .po file. It will break
# msgfmt on Windows.
badlines=`fgrep '#~|' ${filename} | wc -l`
# detect whether this sequence occurs in any .po file. It will break
# msgfmt on Windows.
echo "Files with illegal comment sequence:"
fgrep -l '#~|' *.po
# produce comma-separated values
echo "$filename,$complete,$((complete*100/total)),$badlines"
done | sort -n -t , -k3
exit 0