diff options
author | Bruno Haible <bruno@clisp.org> | 2001-12-17 17:41:37 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-21 23:48:14 +0200 |
commit | d28a4367bb946525cb6e6f700e3a818f29818574 (patch) | |
tree | cc8047778319b3d5d4d74cd6be655571be78b5c0 /tests/lang-librep | |
parent | 0503b3262a36361c11a3f1ba97246f0341ac14a2 (diff) | |
download | external_gettext-d28a4367bb946525cb6e6f700e3a818f29818574.zip external_gettext-d28a4367bb946525cb6e6f700e3a818f29818574.tar.gz external_gettext-d28a4367bb946525cb6e6f700e3a818f29818574.tar.bz2 |
librep support.
Diffstat (limited to 'tests/lang-librep')
-rwxr-xr-x | tests/lang-librep | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/tests/lang-librep b/tests/lang-librep new file mode 100755 index 0000000..4b1c6fb --- /dev/null +++ b/tests/lang-librep @@ -0,0 +1,86 @@ +#! /bin/sh + +# Test of gettext facilities in the librep language. +# Assumes an fr_FR locale is installed. +# Assumes the following packages are installed: librep. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles prog.jl" +cat <<\EOF > prog.jl +(require 'rep.i18n.gettext) + +(textdomain "prog") +(bindtextdomain "prog" ".") + +(format standard-output "%s\n" (_ "'Your command, please?', asked the waiter.")) + +(format standard-output "%s\n" + (format nil (_ "%s is replaced by %s.") "FF" "EUR")) +EOF + +tmpfiles="$tmpfiles prog.pot" +: ${XGETTEXT=xgettext} +${XGETTEXT} -o prog.pot --omit-header --no-location prog.jl + +tmpfiles="$tmpfiles prog.ok" +cat <<EOF > prog.ok +msgid "'Your command, please?', asked the waiter." +msgstr "" + +#, librep-format +msgid "%s is replaced by %s." +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} prog.ok prog.pot || exit 1 + +tmpfiles="$tmpfiles fr.po" +cat <<\EOF > fr.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 "«Votre commande, s'il vous plait», dit le garçon." + +# Reverse the arguments. +#, librep-format +msgid "%s is replaced by %s." +msgstr "%2$s remplace %1$s." +EOF + +tmpfiles="$tmpfiles fr.po.new" +: ${MSGMERGE=msgmerge} +${MSGMERGE} -q -o fr.po.new fr.po prog.pot + +: ${DIFF=diff} +${DIFF} fr.po fr.po.new || exit 1 + +tmpfiles="$tmpfiles fr" +test -d fr || mkdir fr +test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES + +: ${MSGFMT=msgfmt} +${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po + +tmpfiles="$tmpfiles prog.ok prog.out" +: ${DIFF=diff} +cat <<\EOF > prog.ok +«Votre commande, s'il vous plait», dit le garçon. +EUR remplace FF. +EOF + +# Test for presence of rep. +rep --version >/dev/null 2>/dev/null \ + || { echo "SKIP: lang-librep"; rm -fr $tmpfiles; exit 77; } + +LANGUAGE= LC_ALL=fr_FR rep --no-rc --batch prog.jl > prog.out || exit 1 +${DIFF} prog.ok prog.out || exit 1 + +rm -fr $tmpfiles + +exit 0 |