I did not say that but let's all think more how this could be done.
On Sep 5, 8:21 am, Iceberg <[email protected]> wrote:
> Does this mean there is no objection, and the i18n-able validators
> will soon be available in trunk? :-)
>
> On Sep5, 8:27pm, mdipierro <[email protected]> wrote:
>
> > I agree with Fran.
>
> > On Sep 5, 4:21 am, Fran <[email protected]> wrote:
>
> > > On Sep 5, 8:29 am, Iceberg <[email protected]> wrote:
>
> > > > Currently the error_message of all validators are a phrase in English
>
> > > +1 for getting this fixed in a DRY manner :)
>
> > > > (1) let the default error_message be i18n-ready:
> > > > or if somehow you don't like validators.py depends on T(), then you
> > > > can:
>
> > > tools.py does this by using the Messages() class for messages.
> > > We should follow the same pattern if possible:
>
> > > class IS_NOT_IN_DB(...):
> > > def __init__(..., environment):
> > > self.messages = Messages(None)
> > > self.messages.error = 'value already in database!'
> > > self.messages['T'] = self.environment.T
>
> > > I suspect this isn't possible, though, since gluon modules are
> > > executed rather than being imported?
>
> > > > (2) let the default error_message be easier customizable:
> > > > so in app's model file we can:
> > > > IS_NOT_IN_DB.error_message = T('value already in database!') # class
>
> > > This would a reasomable backwards-compatible alternative, especially
> > > if a file was added to the scaffolding apps's models folder which had
> > > all these strings in (& was maintained as/when new validators are
> > > added).
> > > (This file can easily be copied into other existing apps)
>
> > > On syntax, I think we should maintain the one which comes with tools,
> > > so:
> > > IS_NOT_IN_DB.messages.error = T('value already in database!')
>
> > > F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---