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

# Test Lua support

cat <<\EOF > xg-lu-2.lua
-- This comment won't be extracted.
print(_"Hmm.")
-- Neither this one.
print(_"Test.")
--   TRANSLATORS: Hello translators, how are you today?
print(_"We're fine, thanks.")
--[[ Do not extract this, please ]]

--[[  TRANSLATORS:
Attention!
]]
print(--[=[	TRANSLATORS: This is a comment for you!]=] _(--[[TRANSLATORS: Nobody else is supposed to read this!]]
"flowers" --[===[ TRANSLATORS: Nobody will see this.]===] .. --[[ TRANSLATORS: How sad.]] " and " .. --[[Secret text!]]
"biscuits" --[=[TRANSLATORS: Hey you!]=]))

--[==[TRANSLATORS: :-]]==]
print(_"A string.")
EOF

: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
  -d xg-lu-2.tmp xg-lu-2.lua || Exit 1
LC_ALL=C tr -d '\r' < xg-lu-2.tmp.po > xg-lu-2.po || Exit 1

cat <<EOF > xg-lu-2.ok
msgid "Hmm."
msgstr ""

msgid "Test."
msgstr ""

#. TRANSLATORS: Hello translators, how are you today?
msgid "We're fine, thanks."
msgstr ""

#. TRANSLATORS:
#. Attention!
#.
#. TRANSLATORS: This is a comment for you!
#. TRANSLATORS: Nobody else is supposed to read this!
msgid "flowers and biscuits"
msgstr ""

#. TRANSLATORS: :-]
msgid "A string."
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-lu-2.ok xg-lu-2.po
result=$?

exit $result