Answer the question
In order to leave comments, you need to log in
How to translate only custom errors to DRF?
DRF out of the box can give errors in Russian, if you specify Accept-Language: ru
.
I need to translate my custom errors.
The documentation says the following:
If you're only translating custom error messages that exist inside your project codebase you don't need to copy the REST framework source django.po file into a LOCALE_PATHS folder, and can instead simply run Django's standard makemessages process.
_('Error message')
LOCALE_PATHS
python manage.py makemessages -l ru
python manage.py compilemessages
Answer the question
In order to leave comments, you need to log in
It was necessary to simply exclude texts from packages using the --ignore key
python manage.py makemessages -l ru --ignore=env
python manage.py compilemessages -l ru --ignore=env
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question