lang: translation of django's response

This commit is contained in:
AdrienLSH 2024-01-31 13:54:36 +01:00
parent 2f5cfc0e57
commit d4575c92db
2 changed files with 9 additions and 1 deletions

View File

@ -114,6 +114,7 @@ class Client
headers: {
"Content-Type": "application/json",
"X-CSRFToken": getCookie("csrftoken"),
'Accept-Language': this.lang.currentLang,
},
body: JSON.stringify(data),
});

View File

@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
import os
from pathlib import Path
from django.utils.translation import gettext_lazy as _
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -79,6 +80,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
]
ROOT_URLCONF = 'transcendence.urls'
@ -137,6 +139,11 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE = 'en-us'
LANGUAGES = [
('en', _('English')),
('fr', _('French')),
]
TIME_ZONE = 'UTC'
USE_I18N = True