Mercurial > babel > mirror
comparison babel/messages/tests/pofile.py @ 441:942afedbb3d7 trunk
Make sure to only strip on the first occurence of ].
Submitted by: Benoit Boissinot
author | jruigrok |
---|---|
date | Fri, 19 Feb 2010 13:08:56 +0000 |
parents | a974d298400f |
children | af7b13202b11 |
comparison
equal
deleted
inserted
replaced
440:2e8fa2145a13 | 441:942afedbb3d7 |
---|---|
198 catalog = pofile.read_po(buf, locale='ja_JP') | 198 catalog = pofile.read_po(buf, locale='ja_JP') |
199 self.assertEqual(1, len(catalog)) | 199 self.assertEqual(1, len(catalog)) |
200 self.assertEqual(1, catalog.num_plurals) | 200 self.assertEqual(1, catalog.num_plurals) |
201 message = catalog['foo'] | 201 message = catalog['foo'] |
202 self.assertEqual(1, len(message.string)) | 202 self.assertEqual(1, len(message.string)) |
203 | 203 |
204 def test_plural_with_square_brackets(self): | |
205 buf = StringIO(r'''msgid "foo" | |
206 msgid_plural "foo" | |
207 msgstr[0] "Voh [text]" | |
208 msgstr[1] "Vohs [text]"''') | |
209 catalog = pofile.read_po(buf, locale='nb_NO') | |
210 self.assertEqual(1, len(catalog)) | |
211 self.assertEqual(2, catalog.num_plurals) | |
212 message = catalog['foo'] | |
213 self.assertEqual(2, len(message.string)) | |
214 | |
204 def test_more_than_two_plural_forms(self): | 215 def test_more_than_two_plural_forms(self): |
205 buf = StringIO(r'''msgid "foo" | 216 buf = StringIO(r'''msgid "foo" |
206 msgid_plural "foo" | 217 msgid_plural "foo" |
207 msgstr[0] "Voh" | 218 msgstr[0] "Voh" |
208 msgstr[1] "Vohs"''') # last translation form is missing | 219 msgstr[1] "Vohs"''') # last translation form is missing |