jazzband / djangorestframework-simplejwt

A JSON Web Token authentication plugin for the Django REST Framework.
https://django-rest-framework-simplejwt.readthedocs.io/
MIT License
4.03k stars 664 forks source link

The translation of the message "No active account found with the given credentials" does not work in various locales #798

Open Upr82 opened 7 months ago

Upr82 commented 7 months ago

When sending requests to the "auth/jwt/create" endpoint, the message "No active account found with the given credentials" is not translated:

{
    "detail": "No active account found with the given credentials"
}

But the message about the missing field is translated correctly:

{
    "email": [
        "Este campo es requerido."
    ]
}

I checked for the "es" and "ru" locales.

Django==4.2.3
djangorestframework==3.14.0
djangorestframework-simplejwt==5.2.2
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    ...
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.locale.LocaleMiddleware',
]

LANGUAGE_CODE = 'es'
Andrew-Chen-Wang commented 7 months ago

:(

Possibly need locales to be updated. Just merged an auto locale script fixer thanks to some amazing helpers. Will get back to this soon.