#!/bin/sh
#
# Displays a table with the number of unfinished/obsolete/total
# translations in all .ts files.


# Prints a single table row
print_row()
{
	printf '%22s %12s %12s %12s\n' "$@"
}


# Print headers
print_row "File" "Unfinished" "Obsolete" "Total"
print_row "====" "==========" "========" "====="


# Calculate numbers and print line for each file
for tsfile in *.ts ; do
	obsolete=$(fgrep 'type="obsolete"' "$tsfile" | wc -l)
	unfinished=$(fgrep 'type="unfinished"' "$tsfile" | wc -l)
	total=$(fgrep '<translation' "$tsfile" | wc -l)

	print_row "$tsfile" "$unfinished" "$obsolete" "$total"
done
