From 7def9b11d57423da3d5cd62f4b2e2c08d9135635 Mon Sep 17 00:00:00 2001 From: Ramir Mesquita <790844+ramirlm@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:33:10 -0300 Subject: [PATCH] fix: Greek subject translation (M2-8252) (#1673) * fix: greek subject translation * fix: renaming get_localized_subject to get_locallized_email_subject --------- Co-authored-by: Ramir Mesquita --- src/apps/users/services/core.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/apps/users/services/core.py b/src/apps/users/services/core.py index aaf674f8e2b..189a4d4e33f 100644 --- a/src/apps/users/services/core.py +++ b/src/apps/users/services/core.py @@ -29,6 +29,14 @@ def __init__(self, session) -> None: self._cache: PasswordRecoveryCache = PasswordRecoveryCache() self.session = session + def get_locallized_email_subject(self, language: str) -> str: + subjects = { + "en": "Password reset", + "fr": "Réinitialisation du mot de passe", + "el": "Επαναφορά κωδικού πρόσβασης", + } + return subjects.get(language, "Password reset") + async def send_password_recovery( self, schema: PasswordRecoveryRequest, @@ -91,7 +99,7 @@ async def send_password_recovery( message = MessageSchema( recipients=[user.email_encrypted], - subject="Password reset", + subject=self.get_locallized_email_subject(language), body=service.get_localized_html_template( template_name="reset_password", language=language,