Translate external lib text Django [duplicate]
I currently use Base64ImageField
from drf_extra_fields
in a serializer.
This class uses INVALID_FILE_MESSAGE = _("Please upload a valid image.")
and _
comes from from django.utils.translation import gettext_lazy as _
I implemented translations (from english to french) with pyhton manage.py makemessages
and pyhton manage.py compilemessages
to use them.
But to translate the error message from Base64ImageField
, i did not found any relevant solutions:
- Write the translation myself in django.po file, but as soon as i make ```python manage.py makemessages`` it's going to be commented out.
- Avoid my custom translation being commented out by having a file.py with _("Please upload a valid image.")
- Write a custom makemessages command to avoid translation being commented out
Is there any other solution or only "dirtry tricks" work for this issue ?