summaryrefslogtreecommitdiffstats
path: root/l10n-qa/smc-l10n-qa.sh
blob: 4f6511af0d3fc242b69f2427c9143ad198c26a22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

### Main script stars here ###
# Store file name
FILE=""
ERRORPATTERNS=""
# Make sure we get file name as command line argument
# Else read it from standard input device
if [ "$2" == "" ]; then
   FILE="/dev/stdin"
else
   FILE="$2"
   # make sure file exist and readable
   if [ ! -f $FILE ]; then
  	echo "$FILE : does not exists"
  	exit 1
   elif [ ! -r $FILE ]; then
  	echo "$FILE: can not read"
  	exit 2
   fi
fi
# Make sure we get file name as command line argument
# Else read it from standard input device

if [ "$1" == "" ]; then
   	echo "Usage: smc-l10n-qa.sh errorpattern-file pofile"
  	exit 1
else
   ERRORPATTERNS="$1"
   # make sure file exist and readable
   if [ ! -f $ERRORPATTERNS ]; then
  	echo "$ERRORPATTERNS : does not exists"
  	exit 1
   elif [ ! -r $ERRORPATTERNS ]; then
  	echo "$ERRORPATTERNS: can not read"
  	exit 2
   fi
fi
 
while read line
do
	 grep --color -nTwrC3 "$line" $FILE # 2> /dev/null 
done <$ERRORPATTERNS 
echo "Done"
echo "Now trying to compile...." 
msgfmt -c --statistics $FILE
echo "Done"