1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-14 16:46:28 +01:00
Files
audacity/locale/diagnostics.sh
Sol Fisher Romanoff f395687c9f Change bash scripts to be POSIX-compatible
some Unix-like operating systems, namely Alpine, don't come with bash
preinstalled.
scripts in the lib-src/ directory were left untouched.

Signed-off-by: Sol Fisher Romanoff <sol@solfisher.com>
2021-12-02 10:13:12 +02:00

32 lines
883 B
Bash
Executable File

#!/bin/sh
# Report how complete each translation catalog is
# How many messages in total?
total=`grep '^msgid' audacity.pot | wc -l`
#CSV header
echo "Name,Completed,Pct. completed,Bad lines"
badlines=0
for filename in *.po; do
[ -e "$filename" ] || break
# 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 error/ { nn = $3 } END {print 0+nn}'`
complete=$((total-errors))
# detect whether this sequence occurs in any .po file. It will break
# msgfmt on Windows.
badlines=`grep -Fc '#~|' "${filename}"`
# produce comma-separated values
echo "$filename,$complete,$((complete*100/total)),$badlines"
done | sort -n -t , -k3
exit 0