xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/xgettext-objc-2 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
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.po"
31: ${XGETTEXT=xgettext}
32${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
33  -d xg-ob-2 xg-ob-2.m
34test $? = 0 || { rm -fr $tmpfiles; exit 1; }
35
36tmpfiles="$tmpfiles xg-ob-2.ok"
37cat <<EOF > xg-ob-2.ok
38msgid "help"
39msgstr ""
40
41#. TRANSLATORS: This is an extracted comment.
42msgid "me"
43msgstr ""
44
45msgid "Hey Jude"
46msgstr ""
47
48#. TRANSLATORS:
49#. Nickname of the Beatles
50#.
51msgid "The Fabulous Four"
52msgstr ""
53
54#. TRANSLATORS: The strings get concatenated.
55msgid ""
56"there is not enough room on a single line for this entire long, verbose "
57"string"
58msgstr ""
59EOF
60
61: ${DIFF=diff}
62${DIFF} xg-ob-2.ok xg-ob-2.po
63result=$?
64
65rm -fr $tmpfiles
66
67exit $result
68