NetBSD/gnu/dist/gettext/gettext-tools/tests/lang-po

68 lines
1.3 KiB
Plaintext
Raw Normal View History

2005-04-29 19:05:03 +04:00
#! /bin/sh
# Test of gettext facilities in the PO/POT format.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
# Test with POT format.
tmpfiles="$tmpfiles prog-in.pot"
cat <<\EOF > prog-in.pot
msgid "'Your command, please?', asked the waiter."
msgstr ""
#, c-format
msgid "a piece of cake"
msgid_plural "%d pieces of cake"
msgstr[0] ""
msgstr[1] ""
#, c-format
msgid "%s is replaced by %s."
msgstr ""
EOF
tmpfiles="$tmpfiles prog.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o prog.pot --omit-header --add-location prog-in.pot
: ${DIFF=diff}
${DIFF} prog-in.pot prog.pot || exit 1
# Test with PO format.
tmpfiles="$tmpfiles prog-in.po"
cat <<\EOF > prog-in.po
msgid ""
msgstr ""
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "'Your command, please?', asked the waiter."
msgstr "<22>Votre commande, s'il vous plait<69>, dit le gar<61>on."
# Les gateaux allemands sont les meilleurs du monde.
#, c-format
msgid "a piece of cake"
msgid_plural "%d pieces of cake"
msgstr[0] "un morceau de gateau"
msgstr[1] "%d morceaux de gateau"
# Reverse the arguments.
#, c-format
msgid "%s is replaced by %s."
msgstr "%2$s remplace %1$s."
EOF
tmpfiles="$tmpfiles prog.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o prog.po --omit-header --add-location prog-in.po
: ${DIFF=diff}
${DIFF} prog-in.po prog.po || exit 1
rm -fr $tmpfiles
exit 0