diff --git a/frontend/static/js/api/client.js b/frontend/static/js/api/client.js index 3d0a900..1e89882 100644 --- a/frontend/static/js/api/client.js +++ b/frontend/static/js/api/client.js @@ -114,7 +114,8 @@ class Client headers: { "Content-Type": "application/json", "X-CSRFToken": getCookie("csrftoken"), - }, + 'Accept-Language': this.lang.currentLang, + }, body: JSON.stringify(data), }); return response; diff --git a/transcendence/settings.py b/transcendence/settings.py index b75cedb..f6193a8 100644 --- a/transcendence/settings.py +++ b/transcendence/settings.py @@ -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