On Aug 27, 2007, at 3:14 PM, Daniel Haus wrote:
> > Hi! > > Being fairly new to Pylons, I'm working on an Pylons-based (0.9.6rc3) > website that utilizes Genshi, Babel, ToscaWidgets and FormEncode. So > far everything is working fine except for the translations. I was able > to extract and compile language catalogs as described in > http://wiki.pylonshq.com/display/pylonsdocs/Internationalization+and > +Localization > . > > Problem #1: > FormEncode's error messages are not translated at all. What are the > required steps? You can use the new "state" argument to pylons' "validate" decorator (in trunk only since r2347) and set its "_" attribute: from pylons.i18n import _ from pylons.decorators import validate class State: _ = _ class AController(BaseController): @validate(state=State(), ...) def my_meth(self): ... If you're using ToscaWidgets, its "validate" decorator (in toscawidgets.mods.pylonshf) accepts a "state_factory" argument with similar semantics to Pylons' "state" but accepts a callable instead that returns the state: from toscawidgets.mods.pylonshf import validate class AController(BaseController): @validate(state_factory= lambda: State(), ...) def my_meth(self) ... You'll then have to add FormEncode's messages to your app's message catalog, compile it, etc... and that should do it. BTW, I'd love to hear of a way to configure Pylons's "_" function to use the message catalog inside FormEncode's egg instead of copying it inside my app's catalog, is there any? HTH, Alberto --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---