xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/xgettext-3 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1#! /bin/sh
2
3# When a header entry is provided by xgettext, it overrides any msgid ""
4# present in the input.
5
6tmpfiles=""
7trap 'rm -fr $tmpfiles' 1 2 3 15
8
9tmpfiles="$tmpfiles xg-test3.in.c"
10cat <<EOF > xg-test3.in.c
11This is a test of the xgettext functionality.
12/* xgettext:no-c-format */
13_("extract me")
14Sometimes keywords can be spread apart
15xgettext:no-c-format
16_ ( "what about me" )
17And even further on accasion
18_
19(
20"hello"
21)
22
23/* no additional empty strings */
24_("")
25EOF
26
27tmpfiles="$tmpfiles xg-test3.po"
28: ${XGETTEXT=xgettext}
29# delete POT-Creation-Date: line because the date depends on local time.
30${XGETTEXT} --output - --no-location -k_ xg-test3.in.c 2>/dev/null \
31  | sed '/\"POT-Creation-Date:.*/d' > xg-test3.po
32
33tmpfiles="$tmpfiles xg-test3.ok"
34cat <<EOF > xg-test3.ok
35# SOME DESCRIPTIVE TITLE.
36# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
37# This file is distributed under the same license as the PACKAGE package.
38# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
39#
40#, fuzzy
41msgid ""
42msgstr ""
43"Project-Id-Version: PACKAGE VERSION\n"
44"Report-Msgid-Bugs-To: \n"
45"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
46"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
47"Language-Team: LANGUAGE <LL@li.org>\n"
48"MIME-Version: 1.0\n"
49"Content-Type: text/plain; charset=CHARSET\n"
50"Content-Transfer-Encoding: 8bit\n"
51
52#, no-c-format
53msgid "extract me"
54msgstr ""
55
56msgid "what about me"
57msgstr ""
58
59msgid "hello"
60msgstr ""
61EOF
62
63: ${DIFF=diff}
64${DIFF} xg-test3.ok xg-test3.po
65result=$?
66
67rm -fr $tmpfiles
68
69exit $result
70