1#! /bin/sh 2 3# Test of gettext facilities in the RST format. 4 5tmpfiles="" 6trap 'rm -fr $tmpfiles' 1 2 3 15 7 8tmpfiles="$tmpfiles prog.rst" 9cat <<\EOF > prog.rst 10# From the rstconv program itself. 11rstconv.help='rstconv [-h|--help] Displays this help'#10+ 12'rstconv options Convert rst file'#10#10+ 13'Options are:'#10+ 14' -i file Use specified file instead of stdin as input .rst (OPTIONAL)'#10+ 15' -o file Write output to specified file (REQUIRED)'#10+ 16' -f format Specifies the output format:'#10+ 17' po GNU gettext .po (portable) format (DEFAULT)'#10 18 19rstconv.InvalidOption='Invalid option - ' 20rstconv.OptionAlreadySpecified='Option has already been specified - ' 21rstconv.NoOutFilename='No output filename specified' 22rstconv.InvalidOutputFormat='Invalid output format -' 23EOF 24 25tmpfiles="$tmpfiles prog.pot" 26: ${XGETTEXT=xgettext} 27${XGETTEXT} -o prog.pot --omit-header --add-location prog.rst 28 29tmpfiles="$tmpfiles prog.ok" 30cat <<EOF > prog.ok 31#: rstconv.help 32msgid "" 33"rstconv [-h|--help] Displays this help\n" 34"rstconv options Convert rst file\n" 35"\n" 36"Options are:\n" 37" -i file Use specified file instead of stdin as input .rst (OPTIONAL)\n" 38" -o file Write output to specified file (REQUIRED)\n" 39" -f format Specifies the output format:\n" 40" po GNU gettext .po (portable) format (DEFAULT)\n" 41msgstr "" 42 43#: rstconv.InvalidOption 44msgid "Invalid option - " 45msgstr "" 46 47#: rstconv.OptionAlreadySpecified 48msgid "Option has already been specified - " 49msgstr "" 50 51#: rstconv.NoOutFilename 52msgid "No output filename specified" 53msgstr "" 54 55#: rstconv.InvalidOutputFormat 56msgid "Invalid output format -" 57msgstr "" 58EOF 59 60: ${DIFF=diff} 61${DIFF} prog.ok prog.pot || exit 1 62 63# The output of rstconv is slightly different: 64# - ModuleName:ConstName instead of ModuleName.ConstName 65# - no line wrapping 66# - extra newline at the end 67 68tmpfiles="$tmpfiles prog.pot" 69: ${RSTCONV=rstconv} 70if (${RSTCONV} -o prog.pot -i prog.rst) >/dev/null 2>&1; then 71 72tmpfiles="$tmpfiles prog.ok" 73cat <<EOF > prog.ok 74#: rstconv:help 75msgid "rstconv [-h|--help] Displays this help\nrstconv options Convert rst file\n\nOptions are:\n -i file Use specified file instead of stdin as input .rst (OPTIONAL)\n -o file Write output to specified file (REQUIRED)\n -f format Specifies the output format:\n po GNU gettext .po (portable) format (DEFAULT)\n" 76msgstr "" 77 78#: rstconv:InvalidOption 79msgid "Invalid option - " 80msgstr "" 81 82#: rstconv:OptionAlreadySpecified 83msgid "Option has already been specified - " 84msgstr "" 85 86#: rstconv:NoOutFilename 87msgid "No output filename specified" 88msgstr "" 89 90#: rstconv:InvalidOutputFormat 91msgid "Invalid output format -" 92msgstr "" 93 94EOF 95 96: ${DIFF=diff} 97${DIFF} prog.ok prog.pot || exit 1 98 99fi 100 101rm -fr $tmpfiles 102 103exit 0 104