"Max Ischenko" <[EMAIL PROTECTED]> writes:
> I'm trying to write a custom validator that will use localized error
> messages.
Heh... I'm finishing converting almost all of my forms to widgets + datagrid
and I was going to work with this as well.
If you take a look at #572 you'll see that in my patch I've used
turbogears.i18n.format methods and without any errors at all, so there it was
available this kind of information.
I believe that there are some choices here:
1. use lazy_gettext (or whatever is suitable)
2. pass a dictionary with messages, similar to the one available in my patch
3. make the I18N mechanism get all relevant strings from TurboGears and
thirdparty modules and put them in a system potfile with every project
I believe that 2. makes a better solution -- and also easier -- since we won't
have to mess with formencode and TurboGears code when translating our
projects. Unfortunately, it would be a big change in formencode.validators to
allow passing this dictionary and I dunno if Ian would accept such a big
patch.
Another option would be #3. and make sure that the error_handler always return
the localized message when I18N is in effect. The problem, again, is finding
out relevant messages without changing other project's code.
--
Jorge Godoy <[EMAIL PROTECTED]>