From 74655ba3781ea0ebf4c6f9675ee04a54957938c8 Mon Sep 17 00:00:00 2001 From: Sabrina Demagny Date: Fri, 14 Mar 2025 11:02:29 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(domains)=20fix=20admin=20informati?= =?UTF-8?q?on=20messages=20not=20translated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using format or f-string breaks translations --- .../locale/fr_FR/LC_MESSAGES/django.mo | Bin 13769 -> 13676 bytes .../locale/fr_FR/LC_MESSAGES/django.po | 38 +++++++++--------- src/backend/mailbox_manager/admin.py | 38 ++++++++++-------- 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/src/backend/locale/fr_FR/LC_MESSAGES/django.mo b/src/backend/locale/fr_FR/LC_MESSAGES/django.mo index 24589acea86b408068030cd6446f826b8e9bcac5..95cb4ad09c79bf39e1ce5394376f71c8498aace4 100644 GIT binary patch delta 3318 zcma*o4QQ2B9LMqFeA&A%n^RNg?%dSfy{P#z$#=JzEltg-(>ZmwyF2%O=e?WT1iP4~ zvPz9drx2KuAqE<`qEM;k6j4f)l0iyXBU%&&f<_k6_jm6zok-Bb&i$P8yqxnt|8t&a zSE_!i+@Bg4YmC_(W6WecfSGs+v+*8IL1(NngRmI+Gu8Yoz^#~q=WztyK?nYcvvK4= zW2RvtM&O$`3lHLSyfM%Of|YQ3AI*t5sDX<33CBuX9~RNxiUaT_D!|+J_4vWYq|qLQ zjhKg3cpi0s+7M&naT4-~$wi$n7!t4t&LN#_8E-E zczPd(NjMy{k>r`BsEMpY4eZ89^rHgU7N9~OW+#rsLpTc0V1K-Z>fl?{K(|o=cB4}N z0CREV&`^puU;*t-_za%ID7=a4=MHKKx@`lg3C84eq68KB2iOlUpd!AEWYKh@X4H)e z;65twzD%1K%rI2I={N-^<4knh?IV~?`v#_C1cR~n0%j@|1+W@5@KMxedLL)t=ct)H zKxJq!7nQmURDe@Z_vi3KOlBP_u+7M-nVmQhTQL(ap#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)U0d7ec5X(;Hyw`d*{(~Qo1JfCQeCUusg^svvc~HhVy`TzT2^Y8 z76nJF8`|ici%FVSX4jWgjJFwz2;1aeU56ver^wz)6eYB~^i zGQ!=a)AB60OROsUUJk8)li0K|;rfFK^bgE@L;_b2ob-r0x+nJOf8WCYpRA0;mIsrS sG_d0%M$Jr4dgQ|HWhOJZm$NImOaC^BNVm*?3Abyv4v1^&kWvx(4@;2p;{X5v diff --git a/src/backend/locale/fr_FR/LC_MESSAGES/django.po b/src/backend/locale/fr_FR/LC_MESSAGES/django.po index 413b984..852b716 100644 --- a/src/backend/locale/fr_FR/LC_MESSAGES/django.po +++ b/src/backend/locale/fr_FR/LC_MESSAGES/django.po @@ -333,17 +333,17 @@ msgstr "Synchroniser à partir de dimail" #: build/lib/mailbox_manager/admin.py:35 mailbox_manager/admin.py:35 #, python-brace-format -msgid "Synchronisation failed for {domain.name} with message: [{err}]" -msgstr "La synchronisation a échoué pour {domain.name} avec le message : [{err}]" +msgid "Synchronisation failed for %(domain)s with message: %(err)s" +msgstr "La synchronisation a échoué pour %(domain)s avec le message : %(err)s" #: build/lib/mailbox_manager/admin.py:41 mailbox_manager/admin.py:41 #, python-brace-format -msgid "Synchronisation succeed for {domain.name}. " -msgstr "La synchronisation a réussi pour {domain.name}. " +msgid "Synchronisation succeed for %(domain)s. Imported mailboxes: %(mailboxes)s" +msgstr "La synchronisation a réussi pour %(domain)s. Importation des boîtes mails : %(mailboxes)s" #: build/lib/mailbox_manager/admin.py:49 mailbox_manager/admin.py:49 -msgid "Sync require enabled domains. Excluded domains: {', '.join(excluded_domains)}" -msgstr "La synchro nécessite des domaines activés. Les domaines exclus sont : {', '.join(excluded_domains)}" +msgid "Sync require enabled domains. Excluded domains: %(domains)s" +msgstr "La synchro nécessite des domaines activés. Les domaines exclus sont : %(domains)s" #: build/lib/mailbox_manager/admin.py:54 mailbox_manager/admin.py:54 msgid "Check and update status from dimail" @@ -351,16 +351,16 @@ msgstr "Vérifier et mettre à jour le statut à partir de dimail" #: build/lib/mailbox_manager/admin.py:70 mailbox_manager/admin.py:70 #, python-brace-format -msgid "- {domain.name} with message: '{err}'" -msgstr "- {domain.name} avec le message : '{err}'" +msgid "- %(domain)s with message: %(err)s" +msgstr "- %(domain)s avec le message : %(err)s" #: build/lib/mailbox_manager/admin.py:81 mailbox_manager/admin.py:81 msgid "Check domains done with success." msgstr "Vérification des domaines effectuée avec succès." #: build/lib/mailbox_manager/admin.py:82 mailbox_manager/admin.py:82 -msgid "Domains updated: {', '.join(domains_updated)}" -msgstr "Domaines mis à jour : {', '.join(domains_updated)}" +msgid "Domains updated: %(domains)s" +msgstr "Domaines mis à jour : %(domains)s" #: build/lib/mailbox_manager/admin.py:84 mailbox_manager/admin.py:84 msgid "No domain updated." @@ -371,26 +371,26 @@ msgid "Check domain failed for:" msgstr "La vérification du domaine a échoué pour :" #: build/lib/mailbox_manager/admin.py:100 mailbox_manager/admin.py:100 -msgid "Domains disabled are excluded from check: {', '.join(excluded_domains)}" -msgstr "Les domaines désactivés sont exclus de la vérification : {', '.join(excluded_domains)}" +msgid "Domains disabled are excluded from check: %(domains)s" +msgstr "Les domaines désactivés sont exclus de la vérification : %(domains)s" #: build/lib/mailbox_manager/admin.py:105 mailbox_manager/admin.py:105 msgid "Fetch domain expected config from dimail" msgstr "Récupérer la configuration attendue du domaine depuis dimail" #: build/lib/mailbox_manager/admin.py:119 mailbox_manager/admin.py:119 -#, python-brace-format -msgid "Domain expected config fetched with success for {domain.name}." -msgstr "La configuration du domaine attendue a été récupérée avec succès pour {domain.name}." +#, python-format +msgid "Domain expected config fetched with success for %(domain)s." +msgstr "La configuration du domaine attendue a été récupérée avec succès pour %(domain)s." #: build/lib/mailbox_manager/admin.py:123 mailbox_manager/admin.py:123 #, python-brace-format -msgid "Failed to fetch domain expected config for {domain.name}." -msgstr "Impossible de récupérer la configuration attendue pour {domain.name}." +msgid "Failed to fetch domain expected config for %(domain)s." +msgstr "Impossible de récupérer la configuration attendue pour %(domain)s." #: build/lib/mailbox_manager/admin.py:129 mailbox_manager/admin.py:129 -msgid "Domains disabled are excluded from fetch: {', '.join(excluded_domains)}" -msgstr "Les domaines désactivés sont exclus de la vérification : {', '.join(excluded_domains)}" +msgid "Domains disabled are excluded from fetch: %(domains)s" +msgstr "Les domaines désactivés sont exclus de la récupération : %(domains)s" #: build/lib/mailbox_manager/apps.py:11 mailbox_manager/apps.py:11 msgid "Mailbox manager" diff --git a/src/backend/mailbox_manager/admin.py b/src/backend/mailbox_manager/admin.py index 6b1fc36..2422471 100644 --- a/src/backend/mailbox_manager/admin.py +++ b/src/backend/mailbox_manager/admin.py @@ -32,22 +32,22 @@ def sync_mailboxes_from_dimail(modeladmin, request, queryset): # pylint: disabl except exceptions.HTTPError as err: messages.error( request, - _(f"Synchronisation failed for {domain.name} with message: [{err}]"), + _("Synchronisation failed for %(domain)s with message: %(err)s") + % {"domain": domain.name, "err": err}, ) else: messages.success( request, _( - f"Synchronisation succeed for {domain.name}. " - f"Imported mailboxes: {', '.join(imported_mailboxes)}" - ), + "Synchronisation succeed for %(domain)s. Imported mailboxes: %(mailboxes)s" + ) + % {"domain": domain.name, "mailboxes": ", ".join(imported_mailboxes)}, ) if excluded_domains: messages.warning( request, - _( - f"Sync require enabled domains. Excluded domains: {', '.join(excluded_domains)}" - ), + _("Sync require enabled domains. Excluded domains: %(domains)s") + % {"domains": ", ".join(excluded_domains)}, ) @@ -67,7 +67,10 @@ def fetch_domain_status_from_dimail(modeladmin, request, queryset): # pylint: d try: response = client.fetch_domain_status(domain) except exceptions.HTTPError as err: - msg_error.append(_(f"- {domain.name} with message: '{err}'")) + msg_error.append( + _("- %(domain)s with message: %(err)s") + % {"domain": domain.name, "err": err}, + ) else: success = True # temporary (or not?) display content of the dimail response to debug broken state @@ -79,7 +82,7 @@ def fetch_domain_status_from_dimail(modeladmin, request, queryset): # pylint: d if success: msg_success = [ _("Check domains done with success."), - _(f"Domains updated: {', '.join(domains_updated)}") + _("Domains updated: %(domains)s") % {"domains": ", ".join(domains_updated)} if domains_updated else _("No domain updated."), ] @@ -96,9 +99,8 @@ def fetch_domain_status_from_dimail(modeladmin, request, queryset): # pylint: d if excluded_domains: messages.warning( request, - _( - f"Domains disabled are excluded from check: {', '.join(excluded_domains)}" - ), + _("Domains disabled are excluded from check: %(domains)s") + % {"domains": ", ".join(excluded_domains)}, ) @@ -116,18 +118,20 @@ def fetch_domain_expected_config_from_dimail(modeladmin, request, queryset): # if response: messages.success( request, - _(f"Domain expected config fetched with success for {domain.name}."), + _("Domain expected config fetched with success for %(domain)s.") + % {"domain": domain.name}, ) else: messages.error( - request, _(f"Failed to fetch domain expected config for {domain.name}.") + request, + _("Failed to fetch domain expected config for %(domain)s.") + % {"domain": domain.name}, ) if excluded_domains: messages.warning( request, - _( - f"Domains disabled are excluded from fetch: {', '.join(excluded_domains)}" - ), + _("Domains disabled are excluded from fetch: %(domains)s") + % {"domains": ", ".join(excluded_domains)}, )