Home | History | Annotate | Line # | Download | only in tests
      1 #! /bin/sh
      2 
      3 # Test C support: extraction of contexts specified in GNOME glib syntax.
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 tmpfiles="$tmpfiles xg-c-15.c"
      9 cat <<\EOF > xg-c-15.c
     10 /* (glib) The 1-argument Q_ macro is a gettext with context. */
     11 print (Q_ ("Printer|Open"));
     12 /* (hypothetical) The 2-argument Q_ macro is an ngettext with contexts. */
     13 print (Q_ ("Menu|Recent File", "Menu|Recent Files"));
     14 EOF
     15 
     16 tmpfiles="$tmpfiles xg-c-15.po"
     17 : ${XGETTEXT=xgettext}
     18 ${XGETTEXT} --omit-header --no-location \
     19   --keyword=Q_:1g --keyword=Q_:1g,2g \
     20   -d xg-c-15 xg-c-15.c
     21 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     22 
     23 tmpfiles="$tmpfiles xg-c-15.ok"
     24 cat <<EOF > xg-c-15.ok
     25 msgctxt "Printer"
     26 msgid "Open"
     27 msgstr ""
     28 
     29 msgctxt "Menu"
     30 msgid "Recent File"
     31 msgid_plural "Recent Files"
     32 msgstr[0] ""
     33 msgstr[1] ""
     34 EOF
     35 
     36 : ${DIFF=diff}
     37 ${DIFF} xg-c-15.ok xg-c-15.po
     38 result=$?
     39 
     40 rm -fr $tmpfiles
     41 
     42 exit $result
     43