Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-c-9
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test C support: --add-comments option.
5
6 cat <<EOF > xg-c-9.c
7 // This comment will not be extracted.
8 print (gettext ("help"));
9 //  TRANSLATORS: This is an extracted comment.
10 print (gettext ("me"));
11 /* Not extracted either. */
12 print (gettext ("Hey Jude"));
13 /*  TRANSLATORS:
14      Nickname of the Beatles
15 */
16 print (gettext ("The Fabulous Four"));
17 /* TRANSLATORS: The strings get concatenated.  */
18 print (gettext ("there is not enough"
19 " room on a single line for this entire long, " // confusing, eh?
20 "verbose string"));
21 EOF
22
23 : ${XGETTEXT=xgettext}
24 ${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
25   -d xg-c-9.tmp xg-c-9.c || exit 1
26 LC_ALL=C tr -d '\r' < xg-c-9.tmp.po > xg-c-9.po || exit 1
27
28 cat <<EOF > xg-c-9.ok
29 msgid "help"
30 msgstr ""
31
32 #. TRANSLATORS: This is an extracted comment.
33 msgid "me"
34 msgstr ""
35
36 msgid "Hey Jude"
37 msgstr ""
38
39 #. TRANSLATORS:
40 #. Nickname of the Beatles
41 #.
42 msgid "The Fabulous Four"
43 msgstr ""
44
45 #. TRANSLATORS: The strings get concatenated.
46 msgid ""
47 "there is not enough room on a single line for this entire long, verbose "
48 "string"
49 msgstr ""
50 EOF
51
52 : ${DIFF=diff}
53 ${DIFF} xg-c-9.ok xg-c-9.po
54 result=$?
55
56 exit $result