• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test C support: extraction of contexts, disambiguating according to the
5# argument count.
6
7cat <<\EOF > xg-c-ctxt-2.c
8// (KDE) The 1-argument i18n macro is a simple gettext without context.
9print (i18n ("help"));
10// (KDE) The 2-argument i18n macro has the context first.
11print (i18n ("Help", "about"));
12// (KDE) The 3-argument i18n macro is an ngettext without context.
13print (i18n ("error", "errors", 7));
14EOF
15
16: ${XGETTEXT=xgettext}
17${XGETTEXT} --omit-header --no-location \
18  --keyword=i18n:1 --keyword=i18n:1c,2,2t --keyword=i18n:1,2,3t \
19  -d xg-c-ctxt-2.tmp xg-c-ctxt-2.c || Exit 1
20LC_ALL=C tr -d '\r' < xg-c-ctxt-2.tmp.po > xg-c-ctxt-2.po || Exit 1
21
22cat <<EOF > xg-c-ctxt-2.ok
23msgid "help"
24msgstr ""
25
26msgctxt "Help"
27msgid "about"
28msgstr ""
29
30msgid "error"
31msgid_plural "errors"
32msgstr[0] ""
33msgstr[1] ""
34EOF
35
36: ${DIFF=diff}
37${DIFF} xg-c-ctxt-2.ok xg-c-ctxt-2.po
38result=$?
39
40exit $result
41