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