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