1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +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

@ -5,22 +5,25 @@
# How many messages in total? # How many messages in total?
total=`grep '^msgid' audacity.pot | wc -l` 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 for filename in `ls *.po`; do
# If there are errors from msgcmp, then the last line on standard error # 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 # contains a count of problematic messages; else it won't match the
# pattern in awk, so assume no errors # pattern in awk, so assume no errors
errors=`msgcmp $filename audacity.pot 2>&1 | \ 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)) 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 # produce comma-separated values
# msgfmt on Windows. echo "$filename,$complete,$((complete*100/total)),$badlines"
echo "Files with illegal comment sequence:" done | sort -n -t , -k3
fgrep -l '#~|' *.po
exit 0 exit 0