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