Django 404 Error Translation

Hi,

I’ve been attempting to figure the best approach to add translation to error messages.

Here is the ticket #36142 (django.shortcuts.get_object_or_404 does not support translation for error messages (i18n)) – Django

This is what I believe to be the best approach this far:

pulled from this source Translation | Django documentation | Django

from django.http import HttpResponse
from django.utils.translation import gettext as _

def my_view(request):
output = _("Welcome to my site.")
return HttpResponse(output)

The value errors need to be translated from the
various methods when raised django/django/shortcuts.py at stable/5.1.x · django/django · GitHub

Any feedback or suggestions would be appreciated