1 1.1 christos #! /bin/sh 2 1.1 christos 3 1.1 christos # Test C, C++, PO extractors. 4 1.1 christos 5 1.1 christos tmpfiles="" 6 1.1 christos trap 'rm -fr $tmpfiles' 1 2 3 15 7 1.1 christos 8 1.1 christos tmpfiles="$tmpfiles xg-po-1.in.po xg-po-1.c xg-po-1.cc" 9 1.1 christos cat <<EOF > xg-po-1.in.po 10 1.1 christos #: file1.c:199 11 1.1 christos #, fuzzy 12 1.1 christos msgid "extract me" 13 1.1 christos msgstr "some text to get fuzzy copied to result" 14 1.1 christos 15 1.1 christos #: file2.cc:200 16 1.1 christos msgid "what about me" 17 1.1 christos msgstr "" 18 1.1 christos 19 1.1 christos #: file3.c:10 20 1.1 christos #, c-format, fuzzy 21 1.1 christos msgid "hello" 22 1.1 christos msgstr "Again some text for fuzzy" 23 1.1 christos EOF 24 1.1 christos 25 1.1 christos cat <<EOF > xg-po-1.c 26 1.1 christos #include <libintl.h> 27 1.1 christos #include <stdio.h> 28 1.1 christos int 29 1.1 christos main (int argc, char *argv[]) 30 1.1 christos { 31 1.1 christos printf (dcgettext ("hello", "Hello, world.")); 32 1.1 christos return 0; 33 1.1 christos } 34 1.1 christos EOF 35 1.1 christos 36 1.1 christos cat <<EOF > xg-po-1.cc 37 1.1 christos #include <iostream.h> 38 1.1 christos #include <libintl.h> 39 1.1 christos #include <locale.h> 40 1.1 christos int 41 1.1 christos main (int argc, char *argv[]) 42 1.1 christos { 43 1.1 christos cout << dcgettext ("hello", "Hello world!", LC_MESSAGES) << endl; 44 1.1 christos return 0; 45 1.1 christos } 46 1.1 christos EOF 47 1.1 christos 48 1.1 christos tmpfiles="$tmpfiles xg-po-1.po" 49 1.1 christos : ${XGETTEXT=xgettext} 50 1.1 christos ${XGETTEXT} --omit-header -n \ 51 1.1 christos -d xg-po-1 xg-po-1.in.po xg-po-1.c xg-po-1.cc 52 1.1 christos test $? = 0 || { rm -fr $tmpfiles; exit 1; } 53 1.1 christos 54 1.1 christos tmpfiles="$tmpfiles xg-po-1.ok" 55 1.1 christos cat <<EOF > xg-po-1.ok 56 1.1 christos #: file1.c:199 57 1.1 christos #, fuzzy 58 1.1 christos msgid "extract me" 59 1.1 christos msgstr "some text to get fuzzy copied to result" 60 1.1 christos 61 1.1 christos #: file2.cc:200 62 1.1 christos msgid "what about me" 63 1.1 christos msgstr "" 64 1.1 christos 65 1.1 christos #: file3.c:10 66 1.1 christos #, fuzzy, c-format 67 1.1 christos msgid "hello" 68 1.1 christos msgstr "Again some text for fuzzy" 69 1.1 christos 70 1.1 christos #: xg-po-1.c:6 71 1.1 christos #, c-format 72 1.1 christos msgid "Hello, world." 73 1.1 christos msgstr "" 74 1.1 christos 75 1.1 christos #: xg-po-1.cc:7 76 1.1 christos msgid "Hello world!" 77 1.1 christos msgstr "" 78 1.1 christos EOF 79 1.1 christos 80 1.1 christos : ${DIFF=diff} 81 1.1 christos ${DIFF} xg-po-1.ok xg-po-1.po 82 1.1 christos result=$? 83 1.1 christos 84 1.1 christos rm -fr $tmpfiles 85 1.1 christos 86 1.1 christos exit $result 87