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