﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25571	When number argument is not an integer ungettext_lazy's return value evaluates to False	Michał Przybyś	nobody	"When I tried to pass ungettext_lazy as the message argument for MinLengthValidator:
{{{
MinLengthValidator(4, ungettext_lazy(
    'Name has to be at least %(limit_value)d character long.',
    'Name has to be at least %(limit_value)d characters long.', 'limit_value'
))
}}}
the default message was still used. After fiddling around I found out, that it's because ungettext_lazy's return value's `__len__` returns 0 which makes it evaluate to False and fail a check in BaseValidator's constructor.
{{{
>>> len(ungettext_lazy('%(number)d object', '%(number)d objects', 'number'))
0
>>> len(ungettext_lazy('%(number)d object', '%(number)d objects', 1))
17
>>> bool(ungettext_lazy('%(number)d object', '%(number)d objects', 'number'))
False
>>> bool(ungettext_lazy('%(number)d object', '%(number)d objects', 1))
True
}}}
I'm not sure if this behaviour is a bug, or is it by design and it's a bug in BaseValidator's constructor, but I assume it's the former.

Using django 1.8.5, checked on python 2.7.9 and 3.4.3."	Bug	closed	Internationalization	1.8	Normal	fixed			Ready for checkin	1	0	0	0	0	0
