Mercurial > babel > old > mirror
changeset 332:a7dff175b14f
Fix for #97, compilation of message catalogs for locales with more than two plural forms where the translations were empty was failing.
author | cmlenz |
---|---|
date | Fri, 06 Jun 2008 21:51:48 +0000 |
parents | 852cd3703113 |
children | a355a55a5705 |
files | babel/messages/mofile.py babel/messages/tests/mofile.py |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/babel/messages/mofile.py +++ b/babel/messages/mofile.py @@ -81,7 +81,7 @@ msgstrs = [] for idx, string in enumerate(message.string): if not string: - msgstrs.append(message.id[idx]) + msgstrs.append(message.id[min(int(idx), 1)]) else: msgstrs.append(string) msgstr = '\x00'.join([
--- a/babel/messages/tests/mofile.py +++ b/babel/messages/tests/mofile.py @@ -47,6 +47,13 @@ self.assertEqual(u'Fuzzes', translations.ugettext('Fuzzes')) assert isinstance(translations.ugettext('Fuzzes'), unicode) + def test_more_plural_forms(self): + catalog2 = Catalog(locale='ru_RU') + catalog2.add(('Fuzz', 'Fuzzes'), ('', '', '')) + buf = StringIO() + mofile.write_mo(buf, catalog2) + + def suite(): suite = unittest.TestSuite() suite.addTest(doctest.DocTestSuite(mofile))