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