Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-lua-2
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test Lua support
5
6 cat <<\EOF > xg-lu-2.lua
7 -- This comment won't be extracted.
8 print(_"Hmm.")
9 -- Neither this one.
10 print(_"Test.")
11 --   TRANSLATORS: Hello translators, how are you today?
12 print(_"We're fine, thanks.")
13 --[[ Do not extract this, please ]]
14
15 --[[  TRANSLATORS:
16 Attention!
17 ]]
18 print(--[=[     TRANSLATORS: This is a comment for you!]=] _(--[[TRANSLATORS: Nobody else is supposed to read this!]]
19 "flowers" --[===[ TRANSLATORS: Nobody will see this.]===] .. --[[ TRANSLATORS: How sad.]] " and " .. --[[Secret text!]]
20 "biscuits" --[=[TRANSLATORS: Hey you!]=]))
21
22 --[==[TRANSLATORS: :-]]==]
23 print(_"A string.")
24 EOF
25
26 : ${XGETTEXT=xgettext}
27 ${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
28   -d xg-lu-2.tmp xg-lu-2.lua || exit 1
29 LC_ALL=C tr -d '\r' < xg-lu-2.tmp.po > xg-lu-2.po || exit 1
30
31 cat <<EOF > xg-lu-2.ok
32 msgid "Hmm."
33 msgstr ""
34
35 msgid "Test."
36 msgstr ""
37
38 #. TRANSLATORS: Hello translators, how are you today?
39 msgid "We're fine, thanks."
40 msgstr ""
41
42 #. TRANSLATORS:
43 #. Attention!
44 #.
45 #. TRANSLATORS: This is a comment for you!
46 #. TRANSLATORS: Nobody else is supposed to read this!
47 msgid "flowers and biscuits"
48 msgstr ""
49
50 #. TRANSLATORS: :-]
51 msgid "A string."
52 msgstr ""
53 EOF
54
55 : ${DIFF=diff}
56 ${DIFF} xg-lu-2.ok xg-lu-2.po
57 result=$?
58
59 exit $result