xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/xgettext-ycp-2 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1#!/bin/sh
2
3# Test YCP support: --add-comments option.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles xg-y-2.ycp"
9cat <<EOF > xg-y-2.ycp
10// This comment will not be extracted.
11print (_("help"));
12//  TRANSLATORS: This is an extracted comment.
13print (_("me"));
14# TRANSLATORS: This is extracted too.
15print (_("and you"));
16/* Not extracted either. */
17print (_("Hey Jude"));
18/*  TRANSLATORS:
19     Nickname of the Beatles
20*/
21print (_("The Fabulous Four"));
22EOF
23
24tmpfiles="$tmpfiles xg-y-2.po"
25: ${XGETTEXT=xgettext}
26${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
27  -d xg-y-2 xg-y-2.ycp
28test $? = 0 || { rm -fr $tmpfiles; exit 1; }
29
30tmpfiles="$tmpfiles xg-y-2.ok"
31cat <<EOF > xg-y-2.ok
32msgid "help"
33msgstr ""
34
35#. TRANSLATORS: This is an extracted comment.
36msgid "me"
37msgstr ""
38
39#. TRANSLATORS: This is extracted too.
40msgid "and you"
41msgstr ""
42
43msgid "Hey Jude"
44msgstr ""
45
46#. TRANSLATORS:
47#. Nickname of the Beatles
48#.
49msgid "The Fabulous Four"
50msgstr ""
51EOF
52
53: ${DIFF=diff}
54${DIFF} xg-y-2.ok xg-y-2.po
55result=$?
56
57rm -fr $tmpfiles
58
59exit $result
60