[TurboGears] Re: next up: forms/widgets talk and tickets

2005-12-24 Thread Dan Jacob

I added a lazy_gettext function in the other week which should handle
that. For example:
from turbogears.i18n import lazy_gettext
v=validators.MinLength(minLength=3,
messages={'tooShort':lazy_gettext('Enter at least %(minLength)i
characters')})

The lazy_gettext function calls gettext only when the message is being
converted to a string or string substitution is taking place. This
means you can mark strings for translation before the user locale is
known. This is useful for form encode error messages and form widget
labels, for example, which are declared in advance.



[TurboGears] Re: next up: forms/widgets talk and tickets

2005-12-23 Thread Jorge Godoy

Ian Bicking [EMAIL PROTECTED] writes:

 There should be a way to pass error messages in, but it should just be a
 matter of passing those through to the validators.  Dan Jacob submitted a
 patch for internationalization to FormEncode that I have been very untimely
 in applying.
 
 However, internationalization itself isn't enough, as it's also useful to
 use different context-sensitive messages in different contexts.

One piece at a time :-)  If I can use what's there *and* translate the error
messages, it would be a little more helpful than it is now.  :-)

-- 
Jorge Godoy  [EMAIL PROTECTED]


[TurboGears] Re: next up: forms/widgets talk and tickets

2005-12-22 Thread Jorge Godoy

Kevin Dangoor [EMAIL PROTECTED] writes:

 I *think* good balances have been struck with turbogears.widgets and
 that they're easy to use and build on for the future... but, I'm
 definitely interested in the input of people who have looked closely
 at the problems and want to be sure we end up with the best product
 overall.

I haven't looked that close, but I have two main concerns:

- I18N

- Error messages

I believe that if we could define the error message when we created the widget
it would solve both problems for it.  I have said the same thing on the
devcast reply.  

This would also make it easy to just return a 'dict' and have the customized
error message shown.  When validation was successful, the redirect would do
the rest.


Be seeing you,
-- 
Jorge Godoy  [EMAIL PROTECTED]