forked from dinoex/iroffer-dinoex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-en.sh
executable file
·111 lines (109 loc) · 2.25 KB
/
update-en.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh
copy_if_differ() {
if diff "${1}" "${2}"
then
rm -f "${2}"
else
mv -f "${2}" "${1}"
fi
}
LANG="C"
utf8="cat"
sh ./Lang en
awk -f ./admin.awk src/iroffer_admin.c > help-admin-en.neu
copy_if_differ help-admin-en.txt help-admin-en.neu
for lang in de it fr
do
if test ! "${lang}.sed" -nt "${lang}.txt"
then
echo -n "parsing ... "
sed -e 's| | |' en.txt > en.tmp
sed -e 's| | |' "${lang}.txt" > "${lang}.tmp"
join -t ' ' en.tmp "${lang}.tmp" |
sed -e 's|^[0-9]*|s|' -e 's|" "|"`"|' -e 's|"$|" |' |
awk -F ' ' '
{
if ( $2 == $3 )
next
print
}
' |
${utf8} |
sed -e 's|\\|\\\\|g' -e 's|\*|\\*|g' -e 's|\+|\\+|g' -e 's|\.|\\.|g' -e 's|\[|\\[|g' -e 's|\]|\\]|g' > "${lang}.sed"
rm -f en.tmp "${lang}.tmp"
fi
sed -f "${lang}.sed" src/iroffer_admin.c |
awk -f ./admin.awk > "help-admin-${lang}.neu"
copy_if_differ "help-admin-${lang}.txt" "help-admin-${lang}.neu"
done
#
echo "New in en.txt:"
nr="0"
if test -f en.txt
then
nr=`tail -1 en.txt | cut -d " " -f1`
fi
fgrep -h \" src/iroffer*.c src/dinoex*.c |
grep -v "^#include" |
fgrep -v "NOTRANSLATE" |
sed -e 's|\\"|°|g' |
awk -F \[\"\] '
{
for ( I = 2; I < NF ; I ++ ) {
gsub( "[\\\\]", "\\\\", $I )
if (( $I != "" ))
print "\"" $I "\""
I ++
}
}
' |
sed -e 's|°|\\\\"|g' |
while read text
do
if fgrep -q "${text}" en.txt
then
continue
fi
nr=$((${nr} + 1))
echo "${nr} ${text}"
echo "${nr} ${text}" >> en.txt
done
#
#
echo "Obsolete in en.txt:"
sed -e 's|\\|\\\\|g' en.txt |
while read nr text
do
text="${text#'}"
text="${text%'}"
grep=`fgrep "${text}" src/*.c | fgrep -v NOTRANSLATE`
if test "${grep}" != ""
then
continue
fi
echo "${nr} ${text}"
done
echo "Doppelt in en.txt:"
cut -d " " -f2- en.txt | sort >en.txt.1
cut -d " " -f2- en.txt | sort -u >en.txt.2
diff en.txt.1 en.txt.2
rm -f en.txt.1 en.txt.2
sort -n de.txt en.txt -u >de.txt.neu
if diff -q de.txt de.txt.neu
then
rm -f de.txt.neu
else
diff -u de.txt de.txt.neu
fi
cut -d " " -f1 en.txt >en.txt.1
cut -d " " -f1 de.txt >de.txt.1
cut -d " " -f1 it.txt >it.txt.1
cut -d " " -f1 fr.txt >fr.txt.1
echo "Obsolete in de.txt:"
diff de.txt.1 en.txt.1
echo "Obsolete in it.txt:"
diff it.txt.1 en.txt.1
echo "Obsolete in fr.txt:"
diff fr.txt.1 en.txt.1
rm -f de.txt.1 en.txt.1 it.txt.1 fr.txt.1
# eof