Hi Malcolm,

Thanks for the info.  It'll save me a lot of time, now that I know
where to look.

Aaron

On Aug 30, 1:03 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sat, 2008-08-30 at 12:57 -0700, Aaron wrote:
> > Hi, I'm working on a non-English site and need to replace the
> > validation messages from ModelForm (e.g. 'This field is required.')
> > What are some approaches that I can take?
>
> All those strings should already be translated. They're defined in
> django/forms/fields.py and you can see they're all marked for
> translation. So providing you are using the LocaleMiddleware (or some
> other way of setting the locale), the messages will appear naturally in
> the active locale for each viewer.
>
> If you want to replace/change the messages entirely, you need to replace
> them on the instances of the field classes. This would require some
> poking about under the hood for ModelForms, but should be possible. For
> normal forms, you can pass in an error_messages dictionary when you
> specify the form field that controls the messages. Again, have a look at
> django/forms/fields.py for how the default setup is done.
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to