author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 15 Jul 2019 21:13:01 +0200 | |
changeset 15244 | 44533b2e4fb1 |
parent 14221 | 6b7997406121 |
permissions | -rwxr-xr-x |
13965
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
1 |
#!/bin/sh - |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
2 |
# Script to check all engine locale files (XX.txt) |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
3 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
4 |
# HOW TO USE: |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
5 |
# - Run this script in the tools/ directory. |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
6 |
# Result: All problems and missing translations in .txt files will be reported |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
7 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
8 |
# SYNTAX: |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
9 |
# |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
10 |
# ./check_engine_locale_files.sh [file_to_check [show_untranslated]] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
11 |
# |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
12 |
# Optional parameters: |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
13 |
# |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
14 |
# * file_to_check: Add this if you want to check a single file. Use the special value ALL to check all files. |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
15 |
# * show_untranslated: Set to 0 if you want to hide the list of untranslated files, set to 1 otherwise |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
16 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
17 |
SHOW_UNTRANSLATED_STRINGS=1; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
18 |
CHECKED_FILES=*.txt |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
19 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
20 |
# Parse command line |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
21 |
if [[ $# -gt 0 ]] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
22 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
23 |
if [ $1 = ALL ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
24 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
25 |
CHECKED_FILES=*.txt |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
26 |
else |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
27 |
CHECKED_FILES=$1; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
28 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
29 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
30 |
if [[ $# -gt 1 ]] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
31 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
32 |
if [[ $2 -eq 1 ]] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
33 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
34 |
SHOW_UNTRANSLATED_STRINGS=1; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
35 |
elif [[ $2 -eq 0 ]] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
36 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
37 |
SHOW_UNTRANSLATED_STRINGS=0; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
38 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
39 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
40 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
41 |
cd ../share/hedgewars/Data/Locale; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
42 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
43 |
# Temporary files |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
44 |
TEMP_SYMBOLS_EN=$(mktemp); |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
45 |
TEMP_SYMBOLS=$(mktemp); |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
46 |
TEMP_COMPARE=$(mktemp); |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
47 |
TEMP_COMPARE_2=$(mktemp); |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
48 |
TEMP_CHECK=$(mktemp); |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
49 |
TEMP_TEMP=$(mktemp); |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
50 |
declare -a TEMP_PARAMS; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
51 |
for n in 0 1 2 3 4 5 6 7 8 9 |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
52 |
do |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
53 |
TEMP_PARAMS[$n]=$(mktemp); |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
54 |
done |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
55 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
56 |
# Collect list of string IDs |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
57 |
echo -n "" > $TEMP_SYMBOLS_EN; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
58 |
grep -o "^[0-9][0-9]:[0-9][0-9]=" en.txt | cut -c1-5 | sort | uniq > $TEMP_SYMBOLS_EN; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
59 |
TOTAL_STRINGS=`wc -l < $TEMP_SYMBOLS_EN`; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
60 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
61 |
# Collect strings with placeholders (only in 01:XX) |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
62 |
for n in 0 1 2 3 4 5 6 7 8 9 |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
63 |
do |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
64 |
grep -o "^01:[0-9][0-9]=.*%$n.*" en.txt | cut -c1-5 | sort | uniq > $TEMP_PARAMS[$n]; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
65 |
done |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
66 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
67 |
# Iterate through selected language files |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
68 |
for CHECKED_LANG_FILE in $CHECKED_FILES; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
69 |
# Skip files that don't contain engine strings |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
70 |
do |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
71 |
if [[ $CHECKED_LANG_FILE == campaigns_* ]] || [[ $CHECKED_LANG_FILE == missions_* ]] || [ $CHECKED_LANG_FILE == CMakeLists.txt ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
72 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
73 |
continue; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
74 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
75 |
if [ ! -e $CHECKED_LANG_FILE ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
76 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
77 |
echo "ERROR: $CHECKED_LANG_FILE not found!"; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
78 |
continue; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
79 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
80 |
if [ ! -r $CHECKED_LANG_FILE ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
81 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
82 |
echo "ERROR: No permission to read $CHECKED_LANG_FILE!"; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
83 |
continue; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
84 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
85 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
86 |
# Start the tests |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
87 |
echo "== $CHECKED_LANG_FILE =="; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
88 |
MISSING_STRINGS=0; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
89 |
HAS_PROBLEMS=0; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
90 |
|
14221
6b7997406121
Make sure all engine locale files start with either digit, semicolon or are empty
Wuzzy <Wuzzy2@mail.ru>
parents:
13967
diff
changeset
|
91 |
grep -o "^[^0-9;]" $CHECKED_LANG_FILE > $TEMP_CHECK |
6b7997406121
Make sure all engine locale files start with either digit, semicolon or are empty
Wuzzy <Wuzzy2@mail.ru>
parents:
13967
diff
changeset
|
92 |
if [ -s $TEMP_CHECK ] |
6b7997406121
Make sure all engine locale files start with either digit, semicolon or are empty
Wuzzy <Wuzzy2@mail.ru>
parents:
13967
diff
changeset
|
93 |
then |
6b7997406121
Make sure all engine locale files start with either digit, semicolon or are empty
Wuzzy <Wuzzy2@mail.ru>
parents:
13967
diff
changeset
|
94 |
echo "ERROR! Line(s) which does not start with a digit or semicolon found. Problematic line(s):"; |
6b7997406121
Make sure all engine locale files start with either digit, semicolon or are empty
Wuzzy <Wuzzy2@mail.ru>
parents:
13967
diff
changeset
|
95 |
echo "----------"; |
6b7997406121
Make sure all engine locale files start with either digit, semicolon or are empty
Wuzzy <Wuzzy2@mail.ru>
parents:
13967
diff
changeset
|
96 |
cat $TEMP_CHECK; |
6b7997406121
Make sure all engine locale files start with either digit, semicolon or are empty
Wuzzy <Wuzzy2@mail.ru>
parents:
13967
diff
changeset
|
97 |
echo "----------"; |
6b7997406121
Make sure all engine locale files start with either digit, semicolon or are empty
Wuzzy <Wuzzy2@mail.ru>
parents:
13967
diff
changeset
|
98 |
HAS_PROBLEMS=1; |
6b7997406121
Make sure all engine locale files start with either digit, semicolon or are empty
Wuzzy <Wuzzy2@mail.ru>
parents:
13967
diff
changeset
|
99 |
fi |
6b7997406121
Make sure all engine locale files start with either digit, semicolon or are empty
Wuzzy <Wuzzy2@mail.ru>
parents:
13967
diff
changeset
|
100 |
|
13965
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
101 |
if [ $CHECKED_LANG_FILE != en.txt ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
102 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
103 |
grep -o "^[0-9][0-9]:[0-9][0-9]=" $CHECKED_LANG_FILE | cut -c1-5 | sort | uniq > $TEMP_SYMBOLS; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
104 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
105 |
# Find strings with missing placeholders |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
106 |
> $TEMP_COMPARE; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
107 |
> $TEMP_COMPARE_2; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
108 |
for n in 0 1 2 3 4 5 6 7 8 9 |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
109 |
do |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
110 |
grep -o "^01:[0-9][0-9]=.*%$n.*" $CHECKED_LANG_FILE | cut -c1-5 | sort | uniq > $TEMP_CHECK; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
111 |
comm $TEMP_PARAMS[$n] $TEMP_CHECK -2 -3 >> $TEMP_COMPARE; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
112 |
comm $TEMP_PARAMS[$n] $TEMP_CHECK -1 -3 >> $TEMP_COMPARE_2; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
113 |
done |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
114 |
cat $TEMP_COMPARE | cut -c1-5 | sort | uniq > $TEMP_TEMP; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
115 |
cat $TEMP_TEMP > $TEMP_COMPARE; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
116 |
comm $TEMP_COMPARE $TEMP_SYMBOLS -1 -2 > $TEMP_TEMP; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
117 |
if [ -s $TEMP_TEMP ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
118 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
119 |
echo "ERROR! Missing placeholders in these strings:"; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
120 |
cat $TEMP_TEMP; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
121 |
HAS_PROBLEMS=1; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
122 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
123 |
cat $TEMP_COMPARE_2 | cut -c1-5 | sort | uniq > $TEMP_TEMP; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
124 |
cat $TEMP_TEMP > $TEMP_COMPARE_2; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
125 |
comm $TEMP_COMPARE_2 $TEMP_SYMBOLS -1 -2 > $TEMP_TEMP; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
126 |
if [ -s $TEMP_TEMP ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
127 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
128 |
echo "ERROR! Invalid placeholders found in these strings:"; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
129 |
cat $TEMP_TEMP; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
130 |
HAS_PROBLEMS=1; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
131 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
132 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
133 |
# Find superficial strings |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
134 |
comm $TEMP_SYMBOLS_EN $TEMP_SYMBOLS -1 -3 > $TEMP_COMPARE; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
135 |
if [ -s $TEMP_COMPARE ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
136 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
137 |
echo "WARNING! Superficial strings that do not exist in en.txt:"; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
138 |
cat $TEMP_COMPARE; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
139 |
HAS_PROBLEMS=1; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
140 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
141 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
142 |
# Find missing translations |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
143 |
comm $TEMP_SYMBOLS_EN $TEMP_SYMBOLS -2 -3 > $TEMP_COMPARE; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
144 |
if [ -s $TEMP_COMPARE ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
145 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
146 |
if [ $SHOW_UNTRANSLATED_STRINGS -eq 1 ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
147 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
148 |
echo "Missing translations:"; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
149 |
cat $TEMP_COMPARE; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
150 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
151 |
MISSING_STRINGS=`wc -l < $TEMP_COMPARE`; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
152 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
153 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
154 |
# Print summary |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
155 |
if [ $MISSING_STRINGS -ne 0 ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
156 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
157 |
echo "Missing translations TOTAL: $MISSING_STRINGS/$TOTAL_STRINGS"; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
158 |
else |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
159 |
echo "All strings translated!"; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
160 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
161 |
if [ $HAS_PROBLEMS -eq 1 ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
162 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
163 |
echo "Problems have been found."; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
164 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
165 |
else |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
166 |
if [ $HAS_PROBLEMS -eq 0 ] |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
167 |
then |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
168 |
echo "No problems."; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
169 |
fi |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
170 |
fi; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
171 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
172 |
done; |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
173 |
|
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
174 |
# Clean up files |
fa9b22311390
Add script to check engine locale files for problems
Wuzzy <Wuzzy2@mail.ru>
parents:
diff
changeset
|
175 |
rm $TEMP_SYMBOLS $TEMP_SYMBOLS_EN $TEMP_COMPARE $TEMP_COMPARE_2 $TEMP_CHECK $TEMP_TEMP; |