From 859efa26dcaad478fecc76ae7dae87645ceea14b Mon Sep 17 00:00:00 2001 From: Sabrina Demagny Date: Thu, 13 Mar 2025 19:24:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(mail)=20fix=20team=20invitation=20?= =?UTF-8?q?subject=20not=20translated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using format or f-string breaks translations --- src/backend/core/models.py | 5 ++--- .../core/tests/test_models_invitations.py | 8 +++----- .../locale/fr_FR/LC_MESSAGES/django.mo | Bin 13765 -> 13769 bytes .../locale/fr_FR/LC_MESSAGES/django.po | 4 ++-- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/backend/core/models.py b/src/backend/core/models.py index c17fd3f..12ff022 100644 --- a/src/backend/core/models.py +++ b/src/backend/core/models.py @@ -1057,10 +1057,9 @@ class Invitation(BaseInvitation): def _get_mail_subject(self): """Get the subject of the team invitation.""" - role = self.get_role_display().lower() return gettext( - f"[La Suite] You have been invited to become a {role} of a group" - ) + "[La Suite] You have been invited to become a %(role)s of a group" + ) % {"role": self.get_role_display().lower()} def _get_mail_context(self): """Get the template variables for the invitation.""" diff --git a/src/backend/core/tests/test_models_invitations.py b/src/backend/core/tests/test_models_invitations.py index 633228e..936f3c8 100644 --- a/src/backend/core/tests/test_models_invitations.py +++ b/src/backend/core/tests/test_models_invitations.py @@ -246,9 +246,8 @@ def test_models_team_invitations_email(): # pylint: disable-next=no-member assert len(mail.outbox) == 0 - # Please add test for french language after translations update invitation = factories.InvitationFactory( - role="member", team=team, email="john@people.com", issuer__language="en-us" + role="member", team=team, email="john@people.com", issuer__language="fr-fr" ) # pylint: disable-next=no-member @@ -259,13 +258,12 @@ def test_models_team_invitations_email(): assert email.to == [invitation.email] assert ( - email.subject - == "[La Suite] You have been invited to become a member of a group" + email.subject == "[La Suite] Vous avez été invité(e) à être membre d'un groupe" ) email_content = " ".join(email.body.split()) assert ( - f"""You have been invited to be a member of the group "{team.name}" within La Suite.""" + f"""Vous avez été invité(e) à être membre du groupe "{team.name}" au sein de la Suite.""" in email_content ) assert "[//example.com]" in email_content diff --git a/src/backend/locale/fr_FR/LC_MESSAGES/django.mo b/src/backend/locale/fr_FR/LC_MESSAGES/django.mo index c2fc49f381a4dbdab3fd77d1506c21195c9aec22..24589acea86b408068030cd6446f826b8e9bcac5 100644 GIT binary patch delta 1614 zcmXZcc}P@I6vy#1j+Kt3rDdCrnp$d$rUpf&(t;HAN6T2Y`-kl`kr6G_>yH+UC}@gS zDWjyKMbIKkgBl_$49PHvAc!CcqN0Upfxf@yfz0RL`|i8<+;h+K;kw7`8s~eRGBfiJ zH7msB*b|Rn9G=8pcoCEE8phy#9E?xg@ptH>{}V@|H^r;~^HJ-qK&`h5dteRr!EGt# zSTv3O3?$$|jKwn;g$<~UFXI4gLj}-H05 z{kk->B7Ee~7)#?fmf`4hvx&F?!?+Kh;dTsUN1k`0YUCB_ z>b{|_&Nn=g(IjMP$FgZCg)>k^xB#p10B*(4s0G%HFk6cbs{a95z%0j%y)6rqaR%z- zD^LNfM_t)I?1>>9f~PQp{p}_VvSKe$f&4<dZ$1Z7__fPQAFzZqH6&Y}W*iuxS8 zP=UNhr8qi2q92vo@mPxUZ~}&K8g}4XOyr-#{{Rcf|3U`B3{+qWd0B=vs4IDn3gA0V z#S98WC#=REcpm%UB~*a7P@nNVRA#!755nG{A3dZY7SoZ~Ew70DtBNZb&i(haM_8;eNfI4w8YJ3*zgw?3eI*3|-xBGk##?!BJ$NOESp_4SCHf{}7 z#^!r!L$&J?95@ND*HU-yL=higM8TvOlR5I4rR8bi8{sW4( Bwiy5b delta 1615 zcmXxkc}P@I6vy#1YU;S4G1YXBzypLn>u`~V_W9a|DTy%NO3UC@~y$aNNRX7YAFdlb!&1Vrb z4lytskD(jSV;HugHol4@@h&QWK1{+_sEt2iGX8Yt%szzR-uI?-9 z>Y}ql8TBAb`)oW7rLYK9gr!)8M{p;8MlDc1$*czVq5AKU1?(@fw~d=@mV!m7lUJYu zs6k!XL5##E9E)c$i~TJ?gRIyKR3JZ5cOA(^X(11)*wT<#tN@kLwW#Mia05O-VzIO- zq48xHMZW}fp!HacLDZGU<(g%(zZKHZgO#W%u11}3FRJ)XqXK9}3fyiZb!5*m8o%Na z{DbqcaH`od+=E3JMAe9!g2}@LsLa-(FP6qT8U$ruuoS&KrG6u_rnR5~>_L5weW*a* zp;8={AJU6T?HpW)D{(G1;Zl5pHJHdhhoJxq$bT6FK?c^~Sn^VV4X7)5h6>;tF2)QB zL?_&Y!|)=;V=F4a4%BCS2bGzAp2qsRs(pcy)WMYh?XnpS;r{^r+PCrm diff --git a/src/backend/locale/fr_FR/LC_MESSAGES/django.po b/src/backend/locale/fr_FR/LC_MESSAGES/django.po index a8cab0b..413b984 100644 --- a/src/backend/locale/fr_FR/LC_MESSAGES/django.po +++ b/src/backend/locale/fr_FR/LC_MESSAGES/django.po @@ -324,8 +324,8 @@ msgstr "Invitations d'équipe" #: build/lib/core/models.py:1062 core/models.py:1062 #, python-brace-format -msgid "[La Suite] You have been invited to become a {role} of a group" -msgstr "[La Suite] Vous avez été invité(e) à être {role} d'un groupe" +msgid "[La Suite] You have been invited to become a %(role)s of a group" +msgstr "[La Suite] Vous avez été invité(e) à être %(role)s d'un groupe" #: build/lib/mailbox_manager/admin.py:17 mailbox_manager/admin.py:17 msgid "Synchronise from dimail"