blob: 89b2af83aad8ba4f94b0b8d8ff372adf55d30cf2 (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#! /bin/sh
lang="$1"
filter_preseed() {
awk '/^#~/ {
next
}
/^\"?#?d-i/ {
print
in_setting=1
if (/\\+[[:space:]]*(\\n\")?$/) {in_seq=1}
next
}
/\\+[[:space:]]*(\\n\")?$/ {
if (in_setting) {
print
in_seq=1
next
}
}
/.*/ {
if (in_seq) {
print
in_seq=0
}
in_setting=0
}'
}
if [ -z "$lang" ] || ([ ! -d po/"$lang" ] && [ ! -d "./$lang" ]); then
echo "Usage: $(basename $0) <language>"
exit 1
fi
echo "This script performs a very basic sanity check to see if nothing has"
echo "been missed in the translation of preseed.po. It does this by counting"
echo "the number of lines that start with 'd-i' or '#d-i' for both msgid and"
echo "msgstr and printing the result. It will then print a diff between the"
echo "original and translation for a visual check."
echo
echo
tmp_orig=$(mktemp -p /tmp preseed_orig.XXXXXX)
tmp_trans=$(mktemp -p /tmp preseed_trans.XXXXXX)
if [ -d "po/$lang" ]; then
cd po/$lang
sed -n "/^msgid/,/^msgstr/ p" preseed.po | grep -v msgstr | \
filter_preseed >$tmp_orig
sed -n "/^msgstr/,/^$/ p" preseed.po | \
filter_preseed >$tmp_trans
else
filter_preseed <en/appendix/preseed.xml >$tmp_orig
filter_preseed <$lang/appendix/preseed.xml >$tmp_trans
fi
echo "Number of original lines: $(wc -l <$tmp_orig)"
echo "Number of translated lines: $(wc -l <$tmp_trans)"
echo
diff -U0 $tmp_orig $tmp_trans
rm -f $tmp_orig $tmp_trans
|