djangodjango-rest-frameworkinternationalizationdjango-rest-framework-simplejwt

How to translate simplejwt error (django rest framework)?


What is the best way to translate the error: "No active account found with the given credentials" coming from:

from rest_framework_simplejwt.views import TokenObtainPairView
...
urlpatterns = [
    path('token/', TokenObtainPairView.as_view()),

I use React on the frontend and Django and Django Rest Framework on the backend. I changed django settings to: LANGUAGE_CODE = 'pl' but this apparently didn't change the simplejwt error language.


Solution

  • In case others also have this question, here is the answer:

    Add rest_framework_simplejwt to the installed apps as described in the Simple JWT documentation:

    If you wish to use localizations/translations, simply add rest_framework_simplejwt to INSTALLED_APPS.