summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-c-19
blob: 628ecb822364dd0a927e6807584892edf7b3b3c1 (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
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test C support: mixing ANSI escapes, Unicode escapes, and bare
# multibyte characters.

: ${XGETTEXT=xgettext}

cat <<\EOF > err1.c
/* Out of range */
gettext ("\U00110000");
EOF

(LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location --no-wrap -o - err1.c 2>&1; exit) | grep 'invalid Unicode character' || Exit 1

cat <<\EOF > xg-c-19.in.c
/* 最初のコメント */
"最初の文字列";

/* 二番目のコメント */
gettext ("二番目の文字列");

/* 三番目のコメント */
pgettext ("\u30B3\u30F3\u30C6\u30af\u30B9\u30C8\U0001F600\ud835\udc9ea", "\xBB\xB0\xC8\xD6\xCC\xDC\xA4\xCE\xCA\xB8\xBB\xFA\xCe\363");

gettext ("\"\'\?\\\a\b\f\n\r\t\v\xG\0000");
gettext ("\u30A");
EOF

: ${ICONV=iconv}
iconv -f UTF-8 -t EUC-JP < xg-c-19.in.c > xg-c-19.c \
  || { echo "Skipping test: iconv does not work for EUC-JP"; Exit 77; }

${XGETTEXT} --from-code=EUC-JP --add-comments --no-location --no-wrap \
	    -o - xg-c-19.c | grep -v 'POT-Creation-Date' > xg-c-19.tmp.po \
	    || Exit 1
LC_ALL=C tr -d '\r' < xg-c-19.tmp.po > xg-c-19.po || Exit 1

cat <<\EOF > xg-c-19.ok
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. 二番目のコメント
msgid "二番目の文字列"
msgstr ""

#. 三番目のコメント
msgctxt "コンテクスト😀𝒞a"
msgid "三番目の文字列"
msgstr ""

msgid ""
"\"'?\\\a\b\f\n"
"\r\t\v\\xG"
msgstr ""

msgid "\\u30A"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-c-19.ok xg-c-19.po
result=$?

exit $result