Required field error message not translated

My app is setup to support i18n. When I change browser language, my page items (menus, field labels, etc.) are translated to the configured language. But such translation doesn’t happen on the field ‘required’ messages. When a field is required for my model, and I don’t provide a value for it on form, then submit, I got message like “Please fill out this field.” in English, not in the language I selected and is used at all other places on the page.
I’d think this kind of messages are from Django and should already support i18n. I use Firefox. What did I miss?

That’s not necessarily true.

You could have some JavaScript that is performing client-side validation, along with the possibility of using the built-in browser validation available in current browsers.

Ensuring those messages are translated are separate issues and generally have nothing directly to do with Django.

Thanks for confirming Django may not support all its messages for i18n.
I saw some other posted solutions. Didn’t use them because I was afraid they were not the right way with Django – thought Django must already have something on this.
In this case, I’ll evaluate other solutions.

Hi Ken,
I looked at the link you provided. The solution suggested there is to use addEventListener javascript.
My understanding is, this only work when you don’t have existing error message but want to add your own. In my case, Django is already popping the error messages. Just adding another may not work. Such as I followed all the suggestions here, but I still only see the original Django error messages. I guess Django message is local to those fields, and were used prior to my messages – if the suggested solutions are still valid with current Django version.

Actually, there are two different and distinct situations here.

If you are using browser-based validation as described in those docs, Django has absolutely nothing to do with it. The data is never submitted and Django never sees it.

You can tell whether this is the case by looking for a POST request when there’s an error in the form yielding a message. If there’s no POST, then everything is being handled within the browser.

Those messages could be generated either by the browser’s built-in validation or from a JavaScript module. The section in those docs on “Implementing a customized error message” addresses the case of handling this for the browser’s validation. Customizing the JavaScript’s error message is going to depend upon the module itself. (There may or may not be an easy way to do it.) In either of these cases, there’s nothing that you can do within Django to change it. You would need to write (or modify) some JavaScript to make those changes.

Thanks for the clarification. It’s indeed not reached to the server before the message generation.