xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/xgettext-python-2 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1*946379e7Schristos#!/bin/sh
2*946379e7Schristos
3*946379e7Schristos# Test Python support: --add-comments option.
4*946379e7Schristos
5*946379e7Schristostmpfiles=""
6*946379e7Schristostrap 'rm -fr $tmpfiles' 1 2 3 15
7*946379e7Schristos
8*946379e7Schristostmpfiles="$tmpfiles xg-py-2.py"
9*946379e7Schristoscat <<EOF > xg-py-2.py
10*946379e7Schristos# This comment will not be extracted.
11*946379e7Schristosprint gettext.gettext("help")
12*946379e7Schristos#  TRANSLATORS: This is an extracted comment.
13*946379e7Schristosprint gettext.gettext("me")
14*946379e7Schristos# Not extracted either.
15*946379e7Schristosprint gettext.gettext("Hey Jude")
16*946379e7Schristos# TRANSLATORS:
17*946379e7Schristos#    Nickname of the Beatles
18*946379e7Schristosprint gettext.gettext("The Fabulous Four")
19*946379e7Schristos# TRANSLATORS: The strings get concatenated.
20*946379e7Schristosprint gettext.gettext("there is not enough"
21*946379e7Schristos" room on a single line for this entire long, " # confusing, eh?
22*946379e7Schristos"verbose string")
23*946379e7SchristosEOF
24*946379e7Schristos
25*946379e7Schristostmpfiles="$tmpfiles xg-py-2.po"
26*946379e7Schristos: ${XGETTEXT=xgettext}
27*946379e7Schristos${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
28*946379e7Schristos  -d xg-py-2 xg-py-2.py
29*946379e7Schristostest $? = 0 || { rm -fr $tmpfiles; exit 1; }
30*946379e7Schristos
31*946379e7Schristostmpfiles="$tmpfiles xg-py-2.ok"
32*946379e7Schristoscat <<EOF > xg-py-2.ok
33*946379e7Schristosmsgid "help"
34*946379e7Schristosmsgstr ""
35*946379e7Schristos
36*946379e7Schristos#. TRANSLATORS: This is an extracted comment.
37*946379e7Schristosmsgid "me"
38*946379e7Schristosmsgstr ""
39*946379e7Schristos
40*946379e7Schristosmsgid "Hey Jude"
41*946379e7Schristosmsgstr ""
42*946379e7Schristos
43*946379e7Schristos#. TRANSLATORS:
44*946379e7Schristos#. Nickname of the Beatles
45*946379e7Schristosmsgid "The Fabulous Four"
46*946379e7Schristosmsgstr ""
47*946379e7Schristos
48*946379e7Schristos#. TRANSLATORS: The strings get concatenated.
49*946379e7Schristosmsgid ""
50*946379e7Schristos"there is not enough room on a single line for this entire long, verbose "
51*946379e7Schristos"string"
52*946379e7Schristosmsgstr ""
53*946379e7SchristosEOF
54*946379e7Schristos
55*946379e7Schristos: ${DIFF=diff}
56*946379e7Schristos${DIFF} xg-py-2.ok xg-py-2.po
57*946379e7Schristosresult=$?
58*946379e7Schristos
59*946379e7Schristosrm -fr $tmpfiles
60*946379e7Schristos
61*946379e7Schristosexit $result
62