blob: 8df8a041063b18dff8fd62bf333cbeda1cc8e2dd (
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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
#!/bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src
# Test for --check option.
# --check=ellipsis-unicode
cat <<\EOF > xg-ellipsis-u.c
gettext ("This is a sentence...");
ngettext ("This is a sentence", "These are sentences...", 2);
/* xgettext: no-ellipsis-unicode-check */
gettext ("This is another sentence...");
gettext ("This is a multi-sentence example. This is the first sentence. "
"This is the second..., no it's not, this is the second sentence...\n"
"This is the third sentence...? Perhaps.\n");
EOF
: ${XGETTEXT=xgettext}
LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=ellipsis-unicode -d xg-ellipsis-u.tmp xg-ellipsis-u.c 2>xg-ellipsis-u.err
test `grep -c 'ASCII ellipsis' xg-ellipsis-u.err` = 4 || exit 1
LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=ellipsis-unicode --sentence-end=double-space -d xg-ellipsis-ud.tmp xg-ellipsis-u.c 2>xg-ellipsis-ud.err
test `grep -c 'ASCII ellipsis' xg-ellipsis-ud.err` = 3 || exit 1
# --check=space-ellipsis
cat <<\EOF > xg-space-e.c
gettext ("This is a sentence ...");
/* xgettext: no-space-ellipsis-check, no-ellipsis-unicode-check */
gettext ("This is another sentence ...");
gettext ("This is a multi-sentence example. This is the first sentence. "
"This is the second..., no it's not, this is the second sentence ...\n"
"This is the third sentence \u2026? Perhaps.\n");
EOF
LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=space-ellipsis -d xg-space-e.tmp xg-space-e.c 2>xg-space-e.err
test `grep -c 'space before ellipsis' xg-space-e.err` = 3 || exit 1
# --check=quote-unicode
cat <<\EOF > xg-quote-u.c
gettext ("\"double quoted\"");
/* xgettext: no-quote-unicode-check */
gettext ("\"double quoted but ignored\"");
gettext ("double quoted but empty \"\"");
gettext ("\"\" double quoted but empty");
gettext ("\"foo\" \"bar\" \"baz\"");
gettext ("'single quoted'");
/* xgettext: no-quote-unicode-check */
gettext ("'single quoted but ignored'");
gettext ("'foo' 'bar' 'baz'");
gettext ("prefix'single quoted without surrounding spaces'suffix");
gettext ("prefix 'single quoted with surrounding spaces' suffix");
gettext ("single quoted with apostrophe, empty '' ");
gettext ("'single quoted at the beginning of string' ");
gettext (" 'single quoted at the end of string'");
gettext ("line 1\n"
"'single quoted at the beginning of line' \n"
"line 3");
gettext ("line 1\n"
" 'single quoted at the end of line'\n"
"line 3");
gettext ("`single quoted with grave'");
/* xgettext: no-quote-unicode-check */
gettext ("`single quoted with grave but ignored'");
gettext ("single quoted with grave, empty `'");
gettext ("`' single quoted with grave, empty");
gettext ("`double grave`");
EOF
LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=quote-unicode -d xg-quote-u.tmp xg-quote-u.c 2>xg-quote-u.err
test `grep -c 'ASCII double quote' xg-quote-u.err` = 4 || exit 1
test `grep -c 'ASCII single quote' xg-quote-u.err` = 12 || exit 1
# --check=bullet-unicode
cat <<\EOF > xg-bullet-u1.c
gettext ("The following is a list of items:\n\
* item 1\n\
* item 2\n\
* item 3\n");
EOF
: ${XGETTEXT=xgettext}
LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=bullet-unicode -d xg-bullet-u1.tmp xg-bullet-u1.c 2>xg-bullet-u1.err
test `grep -c 'ASCII bullet' xg-bullet-u1.err` = 1 || { cat xg-bullet-u1.err; exit 1; }
cat <<\EOF > xg-bullet-u2.c
gettext ("The following is a list of items:\n\
* item 1\n\
- item 2\n\
* item 3\n");
EOF
: ${XGETTEXT=xgettext}
LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=bullet-unicode -d xg-bullet-u2.tmp xg-bullet-u2.c 2>xg-bullet-u2.err
test `grep -c 'ASCII bullet' xg-bullet-u2.err` = 1 || { cat xg-bullet-u2.err; exit 1; }
cat <<\EOF > xg-bullet-u3.c
gettext ("The following is NOT a list of items:\n\
* item 1\n\
- item 2\n\
* item 3\n");
EOF
: ${XGETTEXT=xgettext}
LANGUAGE= LC_ALL=C ${XGETTEXT} --omit-header --add-comments --check=bullet-unicode -d xg-bullet-u3.tmp xg-bullet-u3.c 2>xg-bullet-u3.err
test `grep -c 'ASCII bullet' xg-bullet-u3.err` = 0 || { cat xg-bullet-u3.err; exit 1; }
|