• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test msgfilter on a PO file with plurals.
5
6cat <<\EOF > mf-test6.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
31: > mf-test6.tmp
32
33cat <<\EOF > mf-test6.sh
34#! /bin/sh
35echo "========================= $MSGFILTER_LOCATION =========================" >> mf-test6.tmp
36if test -n "${MSGFILTER_MSGCTXT+set}"; then
37  echo "context: $MSGFILTER_MSGCTXT" >> mf-test6.tmp
38fi
39cat >> mf-test6.tmp <<MEOF
40$MSGFILTER_MSGID
41$MSGFILTER_MSGID_PLURAL
42$MSGFILTER_PLURAL_FORM
43$MSGFILTER_PREV_MSGID
44$MSGFILTER_PREV_MSGID_PLURAL
45MEOF
46cat
47EOF
48chmod a+x mf-test6.sh
49
50: ${MSGFILTER=msgfilter}
51LC_ALL=C \
52${MSGFILTER} -i mf-test6.po ./mf-test6.sh >/dev/null 2> mf-test6.err
53result=$?
54
55cat mf-test6.err | grep -v 'warning: Locale charset' | grep -v '^ '
56test $result = 0 || { Exit 1; }
57
58LC_ALL=C tr -d '\r' < mf-test6.tmp > mf-test6.out
59
60cat <<\EOF > mf-test6.ok
61========================= mf-test6.po:2 =========================
62
63
64
65
66
67========================= mf-test6.po:8 =========================
68'Your command, please?', asked the waiter.
69
70
71
72
73========================= mf-test6.po:16 =========================
74a piece of cake
75%d pieces of cake
760
77a piece of bread
78%d pieces of bread
79========================= mf-test6.po:16 =========================
80a piece of cake
81%d pieces of cake
821
83a piece of bread
84%d pieces of bread
85========================= mf-test6.po:22 =========================
86%s is replaced by %s.
87
88
89
90
91EOF
92
93: ${DIFF=diff}
94${DIFF} mf-test6.ok mf-test6.out
95result=$?
96
97exit $result
98