Form internationalization

29 views
Skip to first unread message

freaxmind

unread,
Apr 6, 2011, 5:36:14 PM4/6/11
to TurboGears
Hi all,

I have translated most of my application messages, but I can't get my
formencode/sprox internationalization working.

The "extract_message" script command doesn't propose me to translate
form label, and I can't see any method to change it in formencode/
sprox documentation.
With tableform, I can set the __headers__ property to edit columns
headers.

Have you any suggestions ?

Thanks
Freaxmind

Michael Pedersen

unread,
Apr 7, 2011, 11:48:58 PM4/7/11
to turbo...@googlegroups.com
I wish I did, and I'm sorry I don't. Do any of the other more internationally inclined individuals out there have any suggestions?


--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.




--
Michael J. Pedersen
My IM IDs: Jabber/pede...@icelus.tzo.com, ICQ/103345809, AIM/pedermj022171
          Yahoo/pedermj2002, MSN/pederm...@hotmail.com
----------
All humans fail, in both great and small ways we fail continually. Machines fail too. Computers are machines that are managed by humans, the fallout from failure can be spectacular. Your responsibility is to deal with failure, to anticipate it and to eliminate it as far as is humanly and economically wise to achieve. Are your actions part of the problem or part of the solution?

Tobias Bieniek

unread,
Nov 24, 2012, 5:56:25 PM11/24/12
to turbo...@googlegroups.com, m.ped...@icelus.org
The solution for translating the sprox labels was setting them explicitly with the __field_widget_args__ attribute of the ViewBase class. The following snippet from one of my projects shows an example of this:

class NewUserForm(AddRecordForm):
    __model__ = User
    __required_fields__ = ['password']
    __limit_fields__ = ['email_address', 'display_name', 'password', 'verify_password']
    __base_validator__ = user_validator
    __field_widget_args__ = {
        'email_address': dict(label_text=l_('eMail Address')),
        'display_name': dict(label_text=l_('Name')),
        'password': dict(label_text=l_('Password')),
        'verify_password': dict(label_text=l_('Verify Password')),
    }

    email_address = Field(TextField, All(UniqueValue(SAORMProvider(DBSession),
                                                     __model__, 'email_address'),
                                         Email(not_empty=True)))
    display_name = Field(TextField, NotEmpty)
    password = String(min=6)
    verify_password = PasswordField('verify_password')

Reply all
Reply to author
Forward
0 new messages