1#! /bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test msggrep on a PO file with contexts. 5 6cat <<\EOF > mg-test7.po 7msgid "" 8msgstr "" 9"Content-Type: text/plain; charset=UTF-8\n" 10"Content-Transfer-Encoding: 8bit\n" 11 12#. A menu item 13msgctxt "File|" 14msgid "Open" 15msgstr "Ouvrir" 16 17#. A menu item 18msgctxt "File|" 19msgid "New" 20msgstr "Nouveau" 21 22#. Denote a lock's state 23msgctxt "Lock state" 24msgid "Open" 25msgstr "Ouvert" 26 27#. Denote a lock's state 28msgctxt "Lock state" 29msgid "Closed" 30msgstr "Fermé" 31 32#. A product 33msgctxt "Audi" 34msgid "car" 35msgstr "voiture" 36 37#. A product 38msgctxt "Océ" 39msgid "copier" 40msgstr "photocopieur" 41 42#~ msgid "Save As" 43#~ msgstr "Enregistrer l'as" 44 45#. A menu item 46#~ msgctxt "File|" 47#~ msgid "Save As" 48#~ msgstr "Enregistrer sous" 49EOF 50 51: ${MSGGREP=msggrep} 52LC_MESSAGES=C LC_ALL= \ 53${MSGGREP} -J -e "File|" -o mg-test7.tmp mg-test7.po 2> mg-test7.err 54result=$? 55cat mg-test7.err | grep -v 'warning: Locale charset' | grep -v '^ ' 56test $result = 0 || { Exit 1; } 57LC_ALL=C tr -d '\r' < mg-test7.tmp > mg-test7.out || Exit 1 58 59cat <<\EOF > mg-test7.ok 60msgid "" 61msgstr "" 62"Content-Type: text/plain; charset=UTF-8\n" 63"Content-Transfer-Encoding: 8bit\n" 64 65#. A menu item 66msgctxt "File|" 67msgid "Open" 68msgstr "Ouvrir" 69 70#. A menu item 71msgctxt "File|" 72msgid "New" 73msgstr "Nouveau" 74 75#. A menu item 76#~ msgctxt "File|" 77#~ msgid "Save As" 78#~ msgstr "Enregistrer sous" 79EOF 80 81: ${DIFF=diff} 82${DIFF} mg-test7.ok mg-test7.out 83result=$? 84 85exit $result 86