blob: d56d87ad1e6ec6e60343acc562b4c99151241bf5 (
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
|
#!/bin/sh
# Test Python support: recognition of format strings
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles xg-py-5.py"
cat <<\EOF > xg-py-5.py
# Recognition of format strings.
_("This is {only} a brace formatstring.").format(only = "only")
_("This is %s." % "a format");
EOF
tmpfiles="$tmpfiles xg-py-5.tmp.po xg-py-5.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --add-comments --omit-header --no-location --keyword=_ \
-d xg-py-5.tmp xg-py-5.py
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
LC_ALL=C tr -d '\r' < xg-py-5.tmp.po > xg-py-5.po
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
tmpfiles="$tmpfiles xg-py-5.ok"
cat <<EOF > xg-py-5.ok
#. Recognition of format strings.
#, python-brace-format
msgid "This is {only} a brace formatstring."
msgstr ""
#, python-format
msgid "This is %s."
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} xg-py-5.ok xg-py-5.po
result=$?
rm -fr $tmpfiles
exit $result
|