• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test C++ support: test boost-format.
5
6cat <<\EOF > xg-c-format-5.cc
7// These are recognized as boost-format because of the keyword 'format'.
8format(gettext("%s on, %s off"));
9format(gettext("%1$d on, %2$d off"));
10format(gettext("%|1$| on, %|2$| off"));
11format(gettext("%1% on, %2% off"));
12// These are recognized as boost-format only through the heuristics.
13gettext("heuristic %s on, %s off");
14gettext("heuristic %1$d on, %2$d off");
15gettext("heuristic %|1$| on, %|2$| off");
16gettext("heuristic %1% on, %2% off");
17EOF
18
19: ${XGETTEXT=xgettext}
20${XGETTEXT} --omit-header --no-location -d xg-c-format-5.tmp --boost xg-c-format-5.cc || Exit 1
21LC_ALL=C tr -d '\r' < xg-c-format-5.tmp.po > xg-c-format-5.po || Exit 1
22
23# The first 4 are not marked as c-format, because they are known as
24# boost-format. The last 4 are governed by the heuristic. The first two
25# among them are valid c-format strings. The last one is a valid but unlikely
26# c-format string, therefore the heuristic doesn't mark it.
27cat <<\EOF > xg-c-format-5.ok
28#, boost-format
29msgid "%s on, %s off"
30msgstr ""
31
32#, boost-format
33msgid "%1$d on, %2$d off"
34msgstr ""
35
36#, boost-format
37msgid "%|1$| on, %|2$| off"
38msgstr ""
39
40#, boost-format
41msgid "%1% on, %2% off"
42msgstr ""
43
44#, c-format, boost-format
45msgid "heuristic %s on, %s off"
46msgstr ""
47
48#, c-format, boost-format
49msgid "heuristic %1$d on, %2$d off"
50msgstr ""
51
52#, boost-format
53msgid "heuristic %|1$| on, %|2$| off"
54msgstr ""
55
56#, boost-format
57msgid "heuristic %1% on, %2% off"
58msgstr ""
59EOF
60
61: ${DIFF=diff}
62${DIFF} xg-c-format-5.ok xg-c-format-5.po
63result=$?
64
65exit $result
66