From a7b0592c94f3a0e622a09b97df767f2288144b32 Mon Sep 17 00:00:00 2001 From: eric-intuitem <71850047+eric-intuitem@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:53:52 +0100 Subject: [PATCH 1/2] Hotfix for mail language We can set the LANGUAGE_CODE now. The real fix is to ask for user default language in the form. --- backend/ciso_assistant/settings.py | 2 +- backend/locale/fr/LC_MESSAGES/django.mo | Bin 515 -> 461 bytes backend/locale/fr/LC_MESSAGES/django.po | 2 +- enterprise/backend/enterprise_core/settings.py | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/ciso_assistant/settings.py b/backend/ciso_assistant/settings.py index c875af2be..c5cd10d0b 100644 --- a/backend/ciso_assistant/settings.py +++ b/backend/ciso_assistant/settings.py @@ -292,7 +292,7 @@ def set_ciso_assistant_url(_, __, event_dict): # Internationalization # https://docs.djangoproject.com/en/4.2/topics/i18n/ -LANGUAGE_CODE = "en" +LANGUAGE_CODE = os.environ.get("LANGUAGE_CODE", "en") TIME_ZONE = "UTC" diff --git a/backend/locale/fr/LC_MESSAGES/django.mo b/backend/locale/fr/LC_MESSAGES/django.mo index 4e9ee24d9dd0b542c04ff7d72b6fcfcbbea5117b..e544355a5722972806eba55adb2666bce224e787 100644 GIT binary patch delta 114 zcmZo>ImJ#AMtP^q)V#9PywX&K;?g1oXU|}NgbD>k1^{EiTE-&&x~9EJ{_#NGw)JN=?mENCc`$&r3~FD9Kl-%rD)T?aXM7t~oRhO?O#- UX|Y10!r_%AhgU*PIJ}Yp0Dx^UXaE2J diff --git a/backend/locale/fr/LC_MESSAGES/django.po b/backend/locale/fr/LC_MESSAGES/django.po index 01d714301..c4ce6ddbe 100644 --- a/backend/locale/fr/LC_MESSAGES/django.po +++ b/backend/locale/fr/LC_MESSAGES/django.po @@ -52,7 +52,7 @@ msgstr "" #: iam/models.py:279 msgid "Welcome to Ciso Assistant!" -msgstr "" +msgstr "Bienvenue sur CISO Assistant !" #: iam/models.py:326 msgid "last name" diff --git a/enterprise/backend/enterprise_core/settings.py b/enterprise/backend/enterprise_core/settings.py index 88d783fe1..e05ec0462 100644 --- a/enterprise/backend/enterprise_core/settings.py +++ b/enterprise/backend/enterprise_core/settings.py @@ -294,7 +294,7 @@ def set_ciso_assistant_url(_, __, event_dict): # Internationalization # https://docs.djangoproject.com/en/4.2/topics/i18n/ -LANGUAGE_CODE = "en" +LANGUAGE_CODE = os.environ.get("LANGUAGE_CODE", "en") TIME_ZONE = "UTC" From 66d9745e9a9bd89d24514105d47de84dad03dcce Mon Sep 17 00:00:00 2001 From: eric-intuitem <71850047+eric-intuitem@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:56:19 +0100 Subject: [PATCH 2/2] use FORCE_LANGUAGE --- backend/ciso_assistant/settings.py | 2 +- backend/iam/models.py | 6 ++++++ enterprise/backend/enterprise_core/settings.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/ciso_assistant/settings.py b/backend/ciso_assistant/settings.py index c5cd10d0b..c875af2be 100644 --- a/backend/ciso_assistant/settings.py +++ b/backend/ciso_assistant/settings.py @@ -292,7 +292,7 @@ def set_ciso_assistant_url(_, __, event_dict): # Internationalization # https://docs.djangoproject.com/en/4.2/topics/i18n/ -LANGUAGE_CODE = os.environ.get("LANGUAGE_CODE", "en") +LANGUAGE_CODE = "en" TIME_ZONE = "UTC" diff --git a/backend/iam/models.py b/backend/iam/models.py index b25cb9ee7..72cc18cb8 100644 --- a/backend/iam/models.py +++ b/backend/iam/models.py @@ -38,6 +38,8 @@ ) import structlog +from django.utils import translation +import os logger = structlog.get_logger(__name__) @@ -285,6 +287,10 @@ def _create_user( ) logger.info("user created sucessfully", user=user) + FORCE_LANGUAGE = os.environ.get("FORCE_LANGUAGE") + if FORCE_LANGUAGE: + translation.activate(FORCE_LANGUAGE) + print("FORCE_LANGUAGE:", FORCE_LANGUAGE) if mailing: try: diff --git a/enterprise/backend/enterprise_core/settings.py b/enterprise/backend/enterprise_core/settings.py index e05ec0462..88d783fe1 100644 --- a/enterprise/backend/enterprise_core/settings.py +++ b/enterprise/backend/enterprise_core/settings.py @@ -294,7 +294,7 @@ def set_ciso_assistant_url(_, __, event_dict): # Internationalization # https://docs.djangoproject.com/en/4.2/topics/i18n/ -LANGUAGE_CODE = os.environ.get("LANGUAGE_CODE", "en") +LANGUAGE_CODE = "en" TIME_ZONE = "UTC"