• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test Lua support
5
6cat <<\EOF > xg-lu-1.lua
7print(_("This is a test string."))
8print(_('And another one.'))
9print(_("Don't be afraid to extract this one."))
10print(_('I don\'t bite!'))
11print(_("I said: \"This is a test.\""))
12print(_('He said: "You\'re right!"'))
13print(_([[I like brackets.]]))
14print(_([===[Brackets are awesome!]===]))
15print(_([===[==[Even nested brackets]==]===]))
16print(_([===[Or even unmached number of '=' signs]==]===]))
17print(_([=[
18First newline in long bracket is ignored.]=]))
19print(_([=[
20
21Second newline in long bracket is extracted.]=]))
22print(_([=[
23Newlines inside a long bracket string
24and at the end are not special.
25]=]))
26print(_(hmm["nope"]))
27print({_"yep"})
28print(_["nope"])
29print(_("\097"))
30print(_("\x3F\z
31\x2a"))
32print(_("abc" .. "def"))
33print(speed / 1000 .. 'Mbps')
34EOF
35
36: ${XGETTEXT=xgettext}
37${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
38  -d xg-lu-1.tmp xg-lu-1.lua || Exit 1
39LC_ALL=C tr -d '\r' < xg-lu-1.tmp.po > xg-lu-1.po || Exit 1
40
41cat <<EOF > xg-lu-1.ok
42msgid "This is a test string."
43msgstr ""
44
45msgid "And another one."
46msgstr ""
47
48msgid "Don't be afraid to extract this one."
49msgstr ""
50
51msgid "I don't bite!"
52msgstr ""
53
54msgid "I said: \"This is a test.\""
55msgstr ""
56
57msgid "He said: \"You're right!\""
58msgstr ""
59
60msgid "I like brackets."
61msgstr ""
62
63msgid "Brackets are awesome!"
64msgstr ""
65
66msgid "==[Even nested brackets]=="
67msgstr ""
68
69msgid "Or even unmached number of '=' signs]=="
70msgstr ""
71
72msgid "First newline in long bracket is ignored."
73msgstr ""
74
75msgid ""
76"\n"
77"Second newline in long bracket is extracted."
78msgstr ""
79
80msgid ""
81"Newlines inside a long bracket string\n"
82"and at the end are not special.\n"
83msgstr ""
84
85msgid "yep"
86msgstr ""
87
88msgid "a"
89msgstr ""
90
91msgid "?*"
92msgstr ""
93
94msgid "abcdef"
95msgstr ""
96EOF
97
98: ${DIFF=diff}
99${DIFF} xg-lu-1.ok xg-lu-1.po
100result=$?
101
102exit $result
103