• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test PHP support: --add-comments option.
5
6cat <<EOF > xg-ph-1.php
7<?
8// This comment will not be extracted.
9echo _("help");
10//  TRANSLATORS: This is an extracted comment.
11echo _("me");
12# TRANSLATORS: This is extracted too.
13echo _("and you");
14/* Not extracted either. */
15echo _("Hey Jude");
16/*  TRANSLATORS:
17     Nickname of the Beatles
18*/
19echo _("The Fabulous Four");
20// This will not be extracted.
21echo _(table["key"]);
22?>
23EOF
24
25: ${XGETTEXT=xgettext}
26${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
27  -d xg-ph-1.tmp xg-ph-1.php || Exit 1
28LC_ALL=C tr -d '\r' < xg-ph-1.tmp.po > xg-ph-1.po || Exit 1
29
30cat <<EOF > xg-ph-1.ok
31msgid "help"
32msgstr ""
33
34#. TRANSLATORS: This is an extracted comment.
35msgid "me"
36msgstr ""
37
38#. TRANSLATORS: This is extracted too.
39msgid "and you"
40msgstr ""
41
42msgid "Hey Jude"
43msgstr ""
44
45#. TRANSLATORS:
46#. Nickname of the Beatles
47#.
48msgid "The Fabulous Four"
49msgstr ""
50EOF
51
52: ${DIFF=diff}
53${DIFF} xg-ph-1.ok xg-ph-1.po
54result=$?
55
56exit $result
57