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