1#! /bin/sh 2 3# Test of gettext facilities in the YCP language. 4 5tmpfiles="" 6trap 'rm -fr $tmpfiles' 1 2 3 15 7 8tmpfiles="$tmpfiles prog.ycp" 9cat <<\EOF > prog.ycp 10{ 11 textdomain "prog"; 12 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")); 16} 17EOF 18 19tmpfiles="$tmpfiles prog.pot" 20: ${XGETTEXT=xgettext} 21${XGETTEXT} -o prog.pot --omit-header --no-location prog.ycp 22 23tmpfiles="$tmpfiles prog.ok" 24cat <<EOF > prog.ok 25msgid "'Your command, please?', asked the waiter." 26msgstr "" 27 28#, ycp-format 29msgid "a piece of cake" 30msgid_plural "%1 pieces of cake" 31msgstr[0] "" 32msgstr[1] "" 33 34#, ycp-format 35msgid "%1 is replaced by %2." 36msgstr "" 37EOF 38 39: ${DIFF=diff} 40${DIFF} prog.ok prog.pot || exit 1 41 42tmpfiles="$tmpfiles fr.po" 43cat <<\EOF > fr.po 44msgid "" 45msgstr "" 46"Content-Type: text/plain; charset=ISO-8859-1\n" 47"Plural-Forms: nplurals=2; plural=(n > 1);\n" 48 49msgid "'Your command, please?', asked the waiter." 50msgstr "�Votre commande, s'il vous plait�, dit le gar�on." 51 52# Les gateaux allemands sont les meilleurs du monde. 53#, ycp-format 54msgid "a piece of cake" 55msgid_plural "%1 pieces of cake" 56msgstr[0] "un morceau de gateau" 57msgstr[1] "%1 morceaux de gateau" 58 59# Reverse the arguments. 60#, ycp-format 61msgid "%1 is replaced by %2." 62msgstr "%2 remplace %1." 63EOF 64 65tmpfiles="$tmpfiles fr.po.new" 66: ${MSGMERGE=msgmerge} 67${MSGMERGE} -q -o fr.po.new fr.po prog.pot 68 69: ${DIFF=diff} 70${DIFF} fr.po fr.po.new || exit 1 71 72rm -fr $tmpfiles 73 74exit 0 75