• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test C, C++, PO extractors.
5
6cat <<EOF > xg-po-1.in.po
7#: file1.c:199
8#, fuzzy
9msgid "extract me"
10msgstr "some text to get fuzzy copied to result"
11
12#: file2.cc:200
13msgid "what about me"
14msgstr ""
15
16#: file3.c:10
17#, c-format, fuzzy
18msgid "hello"
19msgstr "Again some text for fuzzy"
20EOF
21
22cat <<EOF > xg-po-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-po-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
45: ${XGETTEXT=xgettext}
46${XGETTEXT} --omit-header -n \
47  -d xg-po-1.tmp xg-po-1.in.po xg-po-1.c xg-po-1.cc || Exit 1
48LC_ALL=C tr -d '\r' < xg-po-1.tmp.po > xg-po-1.po || Exit 1
49
50cat <<EOF > xg-po-1.ok
51#: file1.c:199
52#, fuzzy
53msgid "extract me"
54msgstr "some text to get fuzzy copied to result"
55
56#: file2.cc:200
57msgid "what about me"
58msgstr ""
59
60#: file3.c:10
61#, fuzzy, c-format
62msgid "hello"
63msgstr "Again some text for fuzzy"
64
65#: xg-po-1.c:6
66#, c-format
67msgid "Hello, world."
68msgstr ""
69
70#: xg-po-1.cc:7
71msgid "Hello world!"
72msgstr ""
73EOF
74
75: ${DIFF=diff}
76${DIFF} xg-po-1.ok xg-po-1.po
77result=$?
78
79exit $result
80