yast2-trans/po-stats

37 lines
717 B
Bash

#!/bin/bash
export LC_ALL=C; export LANG=C
sed -e 's/.*\.po://' -e 's:,:,\
:g' \
| awk '\
BEGIN{
FS = " ";
all = trans = untrans = fuzzy = 0;
}
# 113 translated messages, 481 fuzzy translations, 605 untranslated messages.
/[[:blank:]]translated/ {
trans += $1;
next
}
/[[:blank:]]untranslated/ {
untrans += $1;
next
}
/[[:blank:]]fuzzy/ {
fuzzy += $1;
next
}
END{
# The statistics.
format = "%13-s: %5d\n"
printf(format, "Translated", trans) ;
printf(format, "Fuzzy", fuzzy);
printf(format, "Untranslated", untrans);
print "--------------------";
all = trans + fuzzy + untrans
printf("%12s : %5d\n", " All strings", all);
printf("%.0f %% are translated\n", 100 / all * trans);
}'