#1136: [PATCH] Enable formencode and turbogears validator translation
-------------------------+--------------------------------------------------
 Reporter:  ghorvath     |        Owner:  anonymous
     Type:  enhancement  |       Status:  new      
 Priority:  normal       |    Milestone:  1.1      
Component:  unassigned   |      Version:  trunk    
 Severity:  normal       |   Resolution:           
 Keywords:               |  
-------------------------+--------------------------------------------------
Comment (by alberto):

 Everything seems fine here (running the 1.0 branch). I've tested with an
 "es" locale file and messages are being translated as expected.

 However, having to change "_" to a dummy function before declaring
 validators and restoring back to the original "_" after is a real pain in
 modules that mix validators and other "translatable" objects.

 Example:

 {{{
 #!py

 dummy_ = lambda x: x
 orig_ = _
 _ = dummy_

 class MyValidator(FancyValidator):
     messages = {
         'foo': _("A foo ocurred"),  # Needs dummy
     }
     ....

 _ = orig_

 class MyWidget(FormField):
     label = _("This is a label")    # Needs TG's lazygettext
     ....
 }}}

 Maybe a hack on FE to avoid the "TypeError: Error when calling the
 metaclass bases" error? (or should I just be a good boy and move all
 validators into a separate module? ;) )


 Thanks!
 Alberto

-- 
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/1136>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Tickets" 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/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---

Reply via email to