summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-properties-1
blob: 63a6cd40ee34905af87dfc890baef6d537c3d3fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#! /bin/sh

# Test C, C++, JavaProperties extractors.

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

tmpfiles="$tmpfiles xg-pr-1.in.properties xg-pr-1.c xg-pr-1.cc"
cat <<EOF > xg-pr-1.in.properties
#: file1.c:199
#, fuzzy
!extract\ me=some text to get fuzzy copied to result

#: file2.cc:200
!what\ about\ me=

#: file3.c:10
#, c-format, fuzzy
!hello=Again some text for fuzzy
EOF

cat <<EOF > xg-pr-1.c
#include <libintl.h>
#include <stdio.h>
int
main (int argc, char *argv[])
{
  printf (dcgettext ("hello", "Hello, world."));
  return 0;
}
EOF

cat <<EOF > xg-pr-1.cc
#include <iostream.h>
#include <libintl.h>
#include <locale.h>
int
main (int argc, char *argv[])
{
  cout << dcgettext ("hello", "Hello world!", LC_MESSAGES) << endl;
  return 0;
}
EOF

tmpfiles="$tmpfiles xg-pr-1.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header -n \
  -d xg-pr-1 xg-pr-1.in.properties xg-pr-1.c xg-pr-1.cc
test $? = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles xg-pr-1.ok"
cat <<EOF > xg-pr-1.ok
#: file1.c:199
#, fuzzy
msgid "extract me"
msgstr "some text to get fuzzy copied to result"

#: file2.cc:200
msgid "what about me"
msgstr ""

#: file3.c:10
#, fuzzy, c-format
msgid "hello"
msgstr "Again some text for fuzzy"

#: xg-pr-1.c:6
#, c-format
msgid "Hello, world."
msgstr ""

#: xg-pr-1.cc:7
msgid "Hello world!"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-pr-1.ok xg-pr-1.po
result=$?

rm -fr $tmpfiles

exit $result