3 # Test of gettext facilities in the YCP language.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles prog.ycp"
13 print (_("'Your command, please?', asked the waiter."));
14 print (sformat (_("a piece of cake", "%1 pieces of cake", n), n));
15 print (sformat (_("%1 is replaced by %2."), "FF", "EUR"));
19 tmpfiles="$tmpfiles prog.tmp prog.pot"
20 : ${XGETTEXT=xgettext}
21 ${XGETTEXT} -o prog.tmp --omit-header --no-location prog.ycp
22 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
23 LC_ALL=C tr -d '\r' < prog.tmp > prog.pot
24 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
26 tmpfiles="$tmpfiles prog.ok"
28 msgid "'Your command, please?', asked the waiter."
32 msgid "a piece of cake"
33 msgid_plural "%1 pieces of cake"
38 msgid "%1 is replaced by %2."
43 ${DIFF} prog.ok prog.pot || exit 1
45 tmpfiles="$tmpfiles fr.po"
49 "Content-Type: text/plain; charset=ISO-8859-1\n"
50 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
52 msgid "'Your command, please?', asked the waiter."
53 msgstr "«Votre commande, s'il vous plait», dit le garçon."
55 # Les gateaux allemands sont les meilleurs du monde.
57 msgid "a piece of cake"
58 msgid_plural "%1 pieces of cake"
59 msgstr[0] "un morceau de gateau"
60 msgstr[1] "%1 morceaux de gateau"
62 # Reverse the arguments.
64 msgid "%1 is replaced by %2."
65 msgstr "%2 remplace %1."
68 tmpfiles="$tmpfiles fr.po.tmp fr.po.new"
69 : ${MSGMERGE=msgmerge}
70 ${MSGMERGE} -q -o fr.po.tmp fr.po prog.pot
71 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
72 LC_ALL=C tr -d '\r' < fr.po.tmp > fr.po.new
73 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
76 ${DIFF} fr.po fr.po.new || exit 1