When no mo files exist for a domain, pluralizer raises inscrutable error #235

mcdonc opened this Issue Jul 14, 2011 · 0 comments


None yet

1 participant

mcdonc commented Jul 14, 2011

This sort of error will be raised when no mofile for a given domain exists, and someone attempts a pluralization against that domain:

Traceback (most recent call last):
  File "/home/chrism/projects/pyramid/pyramid/tests/test_i18n.py", line 487, in test_default_germanic_pluralization
    result = t.dungettext('messages', 'foo1', 'foos1', 2)
  File "/home/chrism/projects/pyramid/pyramid/i18n.py", line 337, in dungettext
    return self._domains.get(domain, self).ungettext(singular, plural, num)
  File "/home/chrism/opt/Python-2.6.5/lib/python2.6/gettext.py", line 409, in ungettext
    tmsg = self._catalog[(msgid1, self.plural(n))]
AttributeError: 'Translations' object has no attribute 'plural'
@mcdonc mcdonc added a commit that closed this issue Jul 14, 2011
@mcdonc mcdonc - Without a mo-file loaded for the combination of domain/locale,
  ``pyramid.i18n.Localizer.pluralize`` run using that domain/locale
  combination raised an inscrutable "translations object has no attr 'plural'
  error.  Now, instead it "works" (it uses a germanic pluralization by
  default).  This is not the "right" thing really (it's nonsensical to try to
  pluralize something without translations for that locale/domain available),
  but it matches the behavior of ``pyramid.i18n.Localizer.translate`` so it's
  at least consistent; see #235.

Closes #235.
@mcdonc mcdonc closed this in 5b5cd6f Jul 14, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment