• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test of gettext facilities in the PO/POT format.
5
6# Test with POT format.
7
8cat <<\EOF > prog-in.pot
9msgid "'Your command, please?', asked the waiter."
10msgstr ""
11
12#, c-format
13msgid "a piece of cake"
14msgid_plural "%d pieces of cake"
15msgstr[0] ""
16msgstr[1] ""
17
18#, c-format
19msgid "%s is replaced by %s."
20msgstr ""
21EOF
22
23: ${XGETTEXT=xgettext}
24${XGETTEXT} -o prog.tmp --omit-header --add-location prog-in.pot || Exit 1
25LC_ALL=C tr -d '\r' < prog.tmp > prog.pot || Exit 1
26
27: ${DIFF=diff}
28${DIFF} prog-in.pot prog.pot || Exit 1
29
30# Test with PO format.
31
32cat <<\EOF > prog-in.po
33msgid ""
34msgstr ""
35"Content-Type: text/plain; charset=ISO-8859-1\n"
36"Plural-Forms: nplurals=2; plural=(n > 1);\n"
37
38msgid "'Your command, please?', asked the waiter."
39msgstr "�Votre commande, s'il vous plait�, dit le gar�on."
40
41# Les gateaux allemands sont les meilleurs du monde.
42#, c-format
43msgid "a piece of cake"
44msgid_plural "%d pieces of cake"
45msgstr[0] "un morceau de gateau"
46msgstr[1] "%d morceaux de gateau"
47
48# Reverse the arguments.
49#, c-format
50msgid "%s is replaced by %s."
51msgstr "%2$s remplace %1$s."
52EOF
53
54: ${XGETTEXT=xgettext}
55${XGETTEXT} -o prog.tmp.po --omit-header --add-location prog-in.po || Exit 1
56LC_ALL=C tr -d '\r' < prog.tmp.po > prog.po || Exit 1
57
58: ${DIFF=diff}
59${DIFF} prog-in.po prog.po || Exit 1
60
61Exit 0
62