-
Notifications
You must be signed in to change notification settings - Fork 16
/
cmploc.sh
executable file
·89 lines (62 loc) · 1.89 KB
/
cmploc.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# Compare localization information in the database with the information found in files.
# Must be run in Bible OL installation directory.
TMP=/tmp/loc$$
if [ -e $TMP -a ! -d $TMP ]; then
echo $TMP exists but is not a directory
exit 1
fi
[ ! -e $TMP ] && mkdir $TMP
# Interface localization
echo "# Comparing interface localization"
mkdir $TMP/interface
iflangs=$(ls myapp/language/langsrc)
for lcode in $iflangs; do
php index.php translate if_db2php $lcode $TMP/interface
done
for lcode in $iflangs; do
echo "# Comparing $lcode"
if [ $lcode = "comment" ]; then
if diff -r myapp/language/langsrc/$lcode $TMP/interface/$lcode > $TMP/output; then
echo " -- No difference"
else
echo
cat $TMP/output
fi
rm $TMP/output
else
php index.php translate if_php_cmp_db $lcode myapp/language/langsrc/$lcode
fi
done
# Grammar localization
echo
echo -n "# Comparing grammar localization"
mkdir $TMP/grammar
php index.php translate gram_db2prop $TMP/grammar
if diff -rb db/property_files $TMP/grammar > $TMP/output; then
echo " -- No difference"
else
echo
cat $TMP/output
fi
rm $TMP/output
# Lexicon localization
echo
echo "# Comparing lexicon localization"
mkdir $TMP/lexicons
# Expects all csv files to be present
for file in lexicons/*.csv; do
srclang=$(echo $file | sed -e 's|lexicons/\([^_]*\)_\(.*\)\.csv|\1|')
dstlang=$(echo $file | sed -e 's|lexicons/\([^_]*\)_\(.*\)\.csv|\2|')
php index.php translate download_lex $srclang $dstlang > $TMP/lexicons/${srclang}_${dstlang}.csv
echo -n "# Comparing $srclang -> $dstlang"
if diff $file $TMP/lexicons/${srclang}_${dstlang}.csv > $TMP/output; then
echo " -- No difference"
else
echo
cat $TMP/output
fi
rm $TMP/output
done
echo
echo "# Files were stored in directory $TMP"