# Required field error message not translated

**URL:** <https://forum.djangoproject.com/t/required-field-error-message-not-translated/22935>\
**Category:** Forms & APIs\
**Created:** [August 10, 2023, 1:00am UTC](https://forum.djangoproject.com/t/required-field-error-message-not-translated/22935 "2023-08-10T01:00:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zejiang](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/zejiang/32/14430_2.png) [@zejiang](https://forum.djangoproject.com/u/zejiang)\
**Post date:** [August 10, 2023, 1:00am UTC](https://forum.djangoproject.com/t/required-field-error-message-not-translated/22935/1 "2023-08-10T01:00:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 10, 2023, 1:33am UTC](https://forum.djangoproject.com/t/required-field-error-message-not-translated/22935/2 "2023-08-10T01:33:11Z")

</div>

> [@zejiang](#):
>
> I’d think this kind of messages are from Django and should already support i18n.

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](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation) available in current browsers.

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

---

<div class="post-metadata">

**Author:** ![zejiang](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/zejiang/32/14430_2.png) [@zejiang](https://forum.djangoproject.com/u/zejiang)\
**Post date:** [August 10, 2023, 12:25pm UTC](https://forum.djangoproject.com/t/required-field-error-message-not-translated/22935/3 "2023-08-10T12:25:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zejiang](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/zejiang/32/14430_2.png) [@zejiang](https://forum.djangoproject.com/u/zejiang)\
**Post date:** [August 10, 2023, 2:19pm UTC](https://forum.djangoproject.com/t/required-field-error-message-not-translated/22935/4 "2023-08-10T14:19:51Z")

</div>

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](https://stackoverflow.com/questions/3436712/create-custom-error-messages-with-model-forms/21762860#21762860), 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.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 10, 2023, 2:30pm UTC](https://forum.djangoproject.com/t/required-field-error-message-not-translated/22935/5 "2023-08-10T14:30:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zejiang](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/zejiang/32/14430_2.png) [@zejiang](https://forum.djangoproject.com/u/zejiang)\
**Post date:** [August 10, 2023, 5:05pm UTC](https://forum.djangoproject.com/t/required-field-error-message-not-translated/22935/6 "2023-08-10T17:05:47Z")

</div>

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