File: gen_translations_stats.sh

package info (click to toggle)
elinks 0.13~20190125-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 17,244 kB
  • sloc: ansic: 102,743; sh: 5,265; python: 3,940; perl: 2,175; makefile: 970; pascal: 930; yacc: 295; lisp: 125; ruby: 70; awk: 65
file content (21 lines) | stat: -rwxr-xr-x 542 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

# This script prints translations statistics for .po files
# existing in the current directory

echo "Translations statistics"
echo "Date: `date`"
echo

for i in *.po; do
	msgfmt --statistics -o /dev/null $i 2>&1 \
	| sed 's/^\([0-9]\+ \)[^0-9]*\([0-9]\+ \)\?[^0-9]*\([0-9]\+ \)\?[^0-9]*$/\1\2\3/g' \
	| awk '{ \
		tot = $1 + $2 + $3; \
		if (tot != 0) \
			printf "%8.0f %8s %6.02f%% (%3d/%3d untranslated)\n",\
			($1*100/tot)*100, "'"$i"'", $1*100/tot, $2+$3, tot}' ;
done | sort -b -k1,1nr -k2,2 | sed 's/^ *[0-9]*//'

echo