• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test msgexec on a PO file with plurals.
5
6cat <<\EOF > mex-test5.po
7msgid ""
8msgstr ""
9"Content-Type: text/plain; charset=ASCII\n"
10"Plural-Forms: nplurals=2; plural=(n > 1);\n"
11
12#, c-format
13msgid "'Your command, please?', asked the waiter."
14msgstr "'Votre commande, s'il vous plait', dit le garcon."
15
16# Les gateaux allemands sont les meilleurs du monde.
17#, c-format
18#| msgid "a piece of bread"
19#| msgid_plural "%d pieces of bread"
20msgid "a piece of cake"
21msgid_plural "%d pieces of cake"
22msgstr[0] "un morceau de gateau"
23msgstr[1] "%d morceaux de gateau"
24
25# Reverse the arguments.
26#, c-format
27msgid "%s is replaced by %s."
28msgstr "%2$s remplace %1$s."
29EOF
30
31cat <<\EOF > mex-test5.sh
32#! /bin/sh
33echo "========================= $MSGEXEC_LOCATION =========================" | LC_ALL=C tr -d '\r'
34if test -n "${MSGEXEC_MSGCTXT+set}"; then
35  echo "context: $MSGEXEC_MSGCTXT" | LC_ALL=C tr -d '\r'
36fi
37cat <<MEOF
38$MSGEXEC_MSGID
39$MSGEXEC_MSGID_PLURAL
40$MSGEXEC_PLURAL_FORM
41$MSGEXEC_PREV_MSGID
42$MSGEXEC_PREV_MSGID_PLURAL
43---
44MEOF
45cat
46echo | LC_ALL=C tr -d '\r'
47exit 0
48EOF
49chmod a+x mex-test5.sh
50
51: ${MSGEXEC=msgexec}
52LC_ALL=C \
53${MSGEXEC} -i mex-test5.po ./mex-test5.sh > mex-test5.out 2> mex-test5.err
54result=$?
55cat mex-test5.err | grep -v 'warning: Locale charset' | grep -v '^ '
56test $result = 0 || { Exit 1; }
57
58cat <<\EOF > mex-test5.ok
59========================= mex-test5.po:2 =========================
60
61
62
63
64
65---
66Content-Type: text/plain; charset=ASCII
67Plural-Forms: nplurals=2; plural=(n > 1);
68
69========================= mex-test5.po:8 =========================
70'Your command, please?', asked the waiter.
71
72
73
74
75---
76'Votre commande, s'il vous plait', dit le garcon.
77========================= mex-test5.po:16 =========================
78a piece of cake
79%d pieces of cake
800
81a piece of bread
82%d pieces of bread
83---
84un morceau de gateau
85========================= mex-test5.po:16 =========================
86a piece of cake
87%d pieces of cake
881
89a piece of bread
90%d pieces of bread
91---
92%d morceaux de gateau
93========================= mex-test5.po:22 =========================
94%s is replaced by %s.
95
96
97
98
99---
100%2$s remplace %1$s.
101EOF
102
103: ${DIFF=diff}
104${DIFF} mex-test5.ok mex-test5.out
105result=$?
106
107exit $result
108