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