1 1.1 christos #! /bin/sh 2 1.1 christos 3 1.1 christos # Test msgmerge and msgcmp on a PO file with contexts. 4 1.1 christos 5 1.1 christos tmpfiles="" 6 1.1 christos trap 'rm -fr $tmpfiles' 1 2 3 15 7 1.1 christos 8 1.1 christos tmpfiles="$tmpfiles mm-test18.po" 9 1.1 christos cat <<\EOF > mm-test18.po 10 1.1 christos msgid "" 11 1.1 christos msgstr "" 12 1.1 christos "Content-Type: text/plain; charset=UTF-8\n" 13 1.1 christos "Content-Transfer-Encoding: 8bit\n" 14 1.1 christos 15 1.1 christos #. A menu item 16 1.1 christos msgctxt "File|" 17 1.1 christos msgid "Open" 18 1.1 christos msgstr "Ouvrir" 19 1.1 christos 20 1.1 christos #. A menu item 21 1.1 christos msgctxt "File|" 22 1.1 christos msgid "New" 23 1.1 christos msgstr "Nouveau" 24 1.1 christos 25 1.1 christos #. A menu item 26 1.1 christos msgctxt "File|" 27 1.1 christos msgid "Save As" 28 1.1 christos msgstr "Enregistrer sous" 29 1.1 christos 30 1.1 christos msgid "Save As" 31 1.1 christos msgstr "Enregistrer l'as" 32 1.1 christos 33 1.1 christos #. Denote a lock's state 34 1.1 christos msgctxt "Lock state" 35 1.1 christos msgid "Open" 36 1.1 christos msgstr "Ouvert" 37 1.1 christos 38 1.1 christos #. Denote a lock's state 39 1.1 christos msgctxt "Lock state" 40 1.1 christos msgid "Closed" 41 1.1 christos msgstr "Ferm" 42 1.1 christos 43 1.1 christos #. A product 44 1.1 christos msgctxt "Audi" 45 1.1 christos msgid "car" 46 1.1 christos msgstr "voiture" 47 1.1 christos 48 1.1 christos #. A product 49 1.1 christos msgctxt "Oc" 50 1.1 christos msgid "copier" 51 1.1 christos msgstr "photocopieur" 52 1.1 christos EOF 53 1.1 christos 54 1.1 christos tmpfiles="$tmpfiles mm-test18.pot" 55 1.1 christos cat <<\EOF > mm-test18.pot 56 1.1 christos # SOME DESCRIPTIVE TITLE. 57 1.1 christos # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 58 1.1 christos # This file is distributed under the same license as the PACKAGE package. 59 1.1 christos # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 60 1.1 christos # 61 1.1 christos #, fuzzy 62 1.1 christos msgid "" 63 1.1 christos msgstr "" 64 1.1 christos "Project-Id-Version: PACKAGE VERSION\n" 65 1.1 christos "Report-Msgid-Bugs-To: \n" 66 1.1 christos "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 67 1.1 christos "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 68 1.1 christos "Language-Team: LANGUAGE <LL (at] li.org>\n" 69 1.1 christos "MIME-Version: 1.0\n" 70 1.1 christos "Content-Type: text/plain; charset=UTF-8\n" 71 1.1 christos "Content-Transfer-Encoding: 8bit\n" 72 1.1 christos 73 1.1 christos #. A menu item 74 1.1 christos msgctxt "File|" 75 1.1 christos msgid "Open" 76 1.1 christos msgstr "" 77 1.1 christos 78 1.1 christos #. A menu item 79 1.1 christos msgctxt "File|" 80 1.1 christos msgid "New" 81 1.1 christos msgstr "" 82 1.1 christos 83 1.1 christos #. A menu item 84 1.1 christos msgctxt "File|" 85 1.1 christos msgid "Close" 86 1.1 christos msgstr "" 87 1.1 christos 88 1.1 christos #. Denote a lock's state 89 1.1 christos msgctxt "Lock state" 90 1.1 christos msgid "Open" 91 1.1 christos msgstr "" 92 1.1 christos 93 1.1 christos #. Denote a lock's state 94 1.1 christos msgctxt "Lock state" 95 1.1 christos msgid "Closed" 96 1.1 christos msgstr "" 97 1.1 christos 98 1.1 christos #. Denote a door's state 99 1.1 christos msgctxt "Door state" 100 1.1 christos msgid "Open" 101 1.1 christos msgstr "" 102 1.1 christos 103 1.1 christos #. Denote a door's state 104 1.1 christos msgctxt "Door state" 105 1.1 christos msgid "Closed" 106 1.1 christos msgstr "" 107 1.1 christos 108 1.1 christos #. A product 109 1.1 christos msgctxt "Audi" 110 1.1 christos msgid "car" 111 1.1 christos msgstr "" 112 1.1 christos 113 1.1 christos #. A product 114 1.1 christos msgctxt "Oc" 115 1.1 christos msgid "copier" 116 1.1 christos msgstr "" 117 1.1 christos EOF 118 1.1 christos 119 1.1 christos : ${MSGCMP=msgcmp} 120 1.1 christos ${MSGCMP} --use-fuzzy --use-untranslated mm-test18.po mm-test18.pot 2>/dev/null 121 1.1 christos test $? = 1 || { rm -fr $tmpfiles; exit 1; } 122 1.1 christos 123 1.1 christos tmpfiles="$tmpfiles mm-test18.new.po" 124 1.1 christos : ${MSGMERGE=msgmerge} 125 1.1 christos ${MSGMERGE} -q -o mm-test18.new.po mm-test18.po mm-test18.pot 126 1.1 christos test $? = 0 || { rm -fr $tmpfiles; exit 1; } 127 1.1 christos 128 1.1 christos tmpfiles="$tmpfiles mm-test18.ok" 129 1.1 christos # Note that the fuzzy guess for "Open" in context "Door state" could be either 130 1.1 christos # "Ouvrir" (from context "File|") or "Ouvert" (from context "Lock state"). 131 1.1 christos cat <<\EOF > mm-test18.ok 132 1.1 christos msgid "" 133 1.1 christos msgstr "" 134 1.1 christos "Report-Msgid-Bugs-To: \n" 135 1.1 christos "Content-Type: text/plain; charset=UTF-8\n" 136 1.1 christos "Content-Transfer-Encoding: 8bit\n" 137 1.1 christos 138 1.1 christos #. A menu item 139 1.1 christos msgctxt "File|" 140 1.1 christos msgid "Open" 141 1.1 christos msgstr "Ouvrir" 142 1.1 christos 143 1.1 christos #. A menu item 144 1.1 christos msgctxt "File|" 145 1.1 christos msgid "New" 146 1.1 christos msgstr "Nouveau" 147 1.1 christos 148 1.1 christos #. A menu item 149 1.1 christos #, fuzzy 150 1.1 christos msgctxt "File|" 151 1.1 christos msgid "Close" 152 1.1 christos msgstr "Ferm" 153 1.1 christos 154 1.1 christos #. Denote a lock's state 155 1.1 christos msgctxt "Lock state" 156 1.1 christos msgid "Open" 157 1.1 christos msgstr "Ouvert" 158 1.1 christos 159 1.1 christos #. Denote a lock's state 160 1.1 christos msgctxt "Lock state" 161 1.1 christos msgid "Closed" 162 1.1 christos msgstr "Ferm" 163 1.1 christos 164 1.1 christos #. Denote a door's state 165 1.1 christos #, fuzzy 166 1.1 christos msgctxt "Door state" 167 1.1 christos msgid "Open" 168 1.1 christos msgstr "Ouvrir" 169 1.1 christos 170 1.1 christos #. Denote a door's state 171 1.1 christos #, fuzzy 172 1.1 christos msgctxt "Door state" 173 1.1 christos msgid "Closed" 174 1.1 christos msgstr "Ferm" 175 1.1 christos 176 1.1 christos #. A product 177 1.1 christos msgctxt "Audi" 178 1.1 christos msgid "car" 179 1.1 christos msgstr "voiture" 180 1.1 christos 181 1.1 christos #. A product 182 1.1 christos msgctxt "Oc" 183 1.1 christos msgid "copier" 184 1.1 christos msgstr "photocopieur" 185 1.1 christos 186 1.1 christos #~ msgctxt "File|" 187 1.1 christos #~ msgid "Save As" 188 1.1 christos #~ msgstr "Enregistrer sous" 189 1.1 christos 190 1.1 christos #~ msgid "Save As" 191 1.1 christos #~ msgstr "Enregistrer l'as" 192 1.1 christos EOF 193 1.1 christos 194 1.1 christos : ${DIFF=diff} 195 1.1 christos ${DIFF} mm-test18.ok mm-test18.new.po 196 1.1 christos test $? = 0 || { rm -fr $tmpfiles; exit 1; } 197 1.1 christos 198 1.1 christos : ${MSGCMP=msgcmp} 199 1.1 christos ${MSGCMP} --use-fuzzy --use-untranslated mm-test18.new.po mm-test18.pot 200 1.1 christos test $? = 0 || { rm -fr $tmpfiles; exit 1; } 201 1.1 christos 202 1.1 christos rm -fr $tmpfiles 203 1.1 christos 204 1.1 christos exit 0 205