From 32efdc77effb1cd4cdec7a929d642dd2ed0b923f Mon Sep 17 00:00:00 2001 From: Philippe Caron Date: Fri, 10 Jan 2025 15:23:00 -0500 Subject: [PATCH] more missing translations found (#2043) --- app/main/forms.py | 62 +++++++++---------- app/main/views/platform_admin.py | 9 +-- .../organisation/settings/index.html | 2 +- app/translations/csv/fr.csv | 33 ++++++++++ 4 files changed, 70 insertions(+), 36 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index f94b0a152c..672e804863 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -1122,7 +1122,7 @@ class ServiceSmsSenderForm(StripWhitespaceForm): class ServiceEditInboundNumberForm(StripWhitespaceForm): - is_default = BooleanField("Make this text message sender the default") + is_default = BooleanField(_l("Make this text message sender the default")) class ServiceLetterContactBlockForm(StripWhitespaceForm): @@ -1194,16 +1194,16 @@ def __init__(self, channel, *args, **kwargs): class SetEmailBranding(StripWhitespaceForm): branding_style = RadioFieldWithNoneOption( - "Branding style", + _l("Branding style"), ) DEFAULT_EN = ( FieldWithLanguageOptions.ENGLISH_OPTION_VALUE, - "English Government of Canada signature", + _l("English Government of Canada signature"), ) DEFAULT_FR = ( FieldWithLanguageOptions.FRENCH_OPTION_VALUE, - "French Government of Canada signature", + _l("French Government of Canada signature"), ) def __init__(self, all_branding_options, current_branding): @@ -1230,57 +1230,57 @@ class PreviewBranding(StripWhitespaceForm): class ServiceUpdateEmailBranding(StripWhitespaceForm): - name = StringField("Name of brand") - text = StringField("Text") + name = StringField(_l("Name of brand")) + text = StringField(_l("Text")) colour = StringField( - "Colour", + _l("Colour"), validators=[ Regexp( regex="^$|^#(?:[0-9a-fA-F]{3}){1,2}$", - message="Must be a valid color hex code (starting with #)", + message=_l("Must be a valid color hex code (starting with #)"), ) ], ) - file = FileField_wtf("Upload a PNG logo") + file = FileField_wtf(_l("Upload a PNG logo")) brand_type = RadioField( - "Brand type", + _l("Brand type"), choices=[ - ("both_english", "English Government of Canada signature and custom logo"), - ("both_french", "French Government of Canada signature and custom logo"), - ("custom_logo", "Custom Logo"), + ("both_english", _l("English Government of Canada signature and custom logo")), + ("both_french", _l("French Government of Canada signature and custom logo")), + ("custom_logo", _l("Custom Logo")), ( "custom_logo_with_background_colour", - "Custom Logo on a background colour", + _l("Custom Logo on a background colour"), ), - ("no_branding", "No branding"), + ("no_branding", _l("No branding")), ], ) - organisation = RadioField("Select an organisation", choices=[]) - alt_text_en = StringField("Alternative text for English logo") - alt_text_fr = StringField("Alternative text for French logo") + organisation = RadioField(_l("Select an organisation"), choices=[]) + alt_text_en = StringField(_l("Alternative text for English logo")) + alt_text_fr = StringField(_l("Alternative text for French logo")) def validate_name(form, name): op = request.form.get("operation") if op == "email-branding-details" and not form.name.data: - raise ValidationError("This field is required") + raise ValidationError(_l("This field is required")) def validate_alt_text_en(form, alt_text_en): op = request.form.get("operation") if op == "email-branding-details" and not form.alt_text_en.data: - raise ValidationError("This field is required") + raise ValidationError(_l("This field is required")) def validate_alt_text_fr(form, alt_text_fr): op = request.form.get("operation") if op == "email-branding-details" and not form.alt_text_fr.data: - raise ValidationError("This field is required") + raise ValidationError(_l("This field is required")) class SVGFileUpload(StripWhitespaceForm): file = FileField_wtf( - "Upload an SVG logo", + _l("Upload an SVG logo"), validators=[ - FileAllowed(["svg"], "SVG Images only!"), - DataRequired(message="You need to upload a file to submit"), + FileAllowed(["svg"], _l("SVG Images only!")), + DataRequired(message=_l("You need to upload a file to submit")), ], ) @@ -1704,13 +1704,13 @@ def get_folder_name(self): class ClearCacheForm(StripWhitespaceForm): model_type = RadioField( - "What do you want to clear today", + _l("What do you want to clear today"), ) class GoLiveNotesForm(StripWhitespaceForm): request_to_go_live_notes = TextAreaField( - "Go live notes", + _l("Go live notes"), filters=[lambda x: x or None], ) @@ -1732,18 +1732,18 @@ def from_organisation(cls, org): on_behalf_of_email=org.agreement_signed_on_behalf_of_email_address, ) - version = StringField("Which version of the agreement do you want to accept?") + version = StringField(_l("Which version of the agreement do you want to accept?")) who = RadioField( - "Who are you accepting the agreement for?", + _l("Who are you accepting the agreement for?"), choices=( ( "me", - "Yourself", + _l("Yourself"), ), ( "someone-else", - "Someone else", + _l("Someone else"), ), ), ) @@ -1770,7 +1770,7 @@ def validate_version(self, field): try: float(field.data) except (TypeError, ValueError): - raise ValidationError("Must be a number") + raise ValidationError(_l("Must be a number")) class GoLiveAboutServiceForm(StripWhitespaceForm): diff --git a/app/main/views/platform_admin.py b/app/main/views/platform_admin.py index 5ff383771a..eb67f23eca 100644 --- a/app/main/views/platform_admin.py +++ b/app/main/views/platform_admin.py @@ -4,6 +4,7 @@ from datetime import datetime from flask import abort, flash, redirect, render_template, request, url_for +from flask_babel import lazy_gettext as _l from notifications_python_client.errors import HTTPError from requests import RequestException @@ -624,20 +625,20 @@ def clear_cache(): "live-service-and-organisation-counts", ], ), - ("gc-articles", ["gc-articles--*", "gc-articles-fallback--*"]), + ("gc_articles", ["gc-articles--*", "gc-articles-fallback--*"]), ] ) form = ClearCacheForm() - form.model_type.choices = [(key, key.replace("_", " ").title()) for key in CACHE_KEYS] + form.model_type.choices = [(key, _l(key.replace("_", " ").title())) for key in CACHE_KEYS] if form.validate_on_submit(): to_delete = form.model_type.data num_deleted = max(redis_client.delete_cache_keys_by_pattern(pattern) for pattern in CACHE_KEYS[to_delete]) - msg = "Removed {} {} object{} from redis" + msg = _l("Removed {count} {name} object{plural} from redis") flash( - msg.format(num_deleted, to_delete, "s" if num_deleted != 1 else ""), + msg.format(count=num_deleted, name=to_delete, plural="s" if num_deleted != 1 else ""), category="default", ) diff --git a/app/templates/views/organisations/organisation/settings/index.html b/app/templates/views/organisations/organisation/settings/index.html index 7ef1ba9935..712e8db951 100644 --- a/app/templates/views/organisations/organisation/settings/index.html +++ b/app/templates/views/organisations/organisation/settings/index.html @@ -63,7 +63,7 @@

{{ _("Settings") }}

}} {% endcall %} {% call row() %} - {{ text_field('Request to go live notes') }} + {{ text_field(_('Request to go live notes')) }} {{ optional_text_field(current_org.request_to_go_live_notes, default='None') }} {{ edit_field( _('Change'), diff --git a/app/translations/csv/fr.csv b/app/translations/csv/fr.csv index 61acc343d5..068b989930 100644 --- a/app/translations/csv/fr.csv +++ b/app/translations/csv/fr.csv @@ -345,6 +345,7 @@ "address","adresse" "addresses","adresses" "Template","Gabarit" +"Template Category","Catégorie de gabarit" "template","gabarit" "Delete","Supprimer" "Back","Retour" @@ -919,6 +920,10 @@ "Providers","Fournisseurs" "Clear cache","Effacer la mémoire cache" "Organisations","Organisations" +"User","Utilisateur" +"Email Branding","Image de marque du courriel" +"Letter Branding","Image de marque de la lettre" +"Gc Articles","Articles GC" "No users found.","Aucun utilisateur trouvé." "User information for","Renseignements de l’utilisateur pour" "No live services","Aucun service activé" @@ -2039,6 +2044,8 @@ "Usage","Utilisation" "Not signed","Non signé" "Edit request to go live notes","Modifier les notes d'activation du service" +"Request to go live notes","Notes d'activation du service" +"None","Non" "Not signed (but we have some service-specific agreements in place)","Non signé (mais des accords spécifiques à certains services sont en place)" "Is this organisation a crown body?","Est-ce une organisation de la Couronne?" "Has this organisation signed the agreement?","Cette organisation a-t-elle signé l'accord?" @@ -2070,3 +2077,29 @@ "For more information, visit usage reports.","Pour plus de détails, consulter les rapports d’utilisation." "{} cannot send any more {} until April 1, {}","{} ne peut plus envoyer de {} d’ici le 1er avril {}." "You cannot send messages from this service. Only team members can send messages.","Vous ne pouvez pas envoyer de messages à partir de ce service. Seuls les membres de l’équipe peuvent envoyer des messages." +"Who are you accepting the agreement for?","Pour qui acceptez-vous cet accord?" +"Yourself","Vous-même" +"Which version of the agreement do you want to accept?","Quelle version de l'accord souhaitez-vous accepter?" +"Must be a number","Doit être un numéro" +"Go live notes","Notes d'activation du service" +"What do you want to clear today","Que voulez-vous effacer aujourd'hui" +"Someone else","Quelqu'un d'autre" +"Removed {count} {name} object{plural} from redis","{count} {name} objet{plural} retiré{plural} de Redis" +"No branding","Aucune image de marque" +"Custom Logo","Logo personnalisé" +"Custom Logo on a background colour","Logo personnalisé sur un fond de couleur" +"Branding style","Style de l'image de marque" +"Upload an SVG logo","Téléverser un logo SVG" +"Must be a valid color hex code (starting with #)","Doit être un code hexadécimal de couleur valide (commençant par #)" +"Select an organisation","Sélectionner une organisation" +"Colour","Couleur" +"This field is required","Ce champ est obligatoire" +"You need to upload a file to submit","Vous devez téléverser un fichier avant de continuer" +"Alternative text for English logo","Texte alternatif pour le logo en anglais" +"Brand type","Type d'image de marque" +"Name of brand","Nom de l'image de marque" +"Alternative text for French logo","Texte alternatif pour le logo en français" +"French Government of Canada signature and custom logo","Signature du gouvernement du Canada en français et logo personnalisé" +"SVG Images only!","Images SVG uniquement" +"English Government of Canada signature and custom logo","Signature du gouvernement du Canada en anglais et logo personnalisé" +"Upload a PNG logo","Téléverser un logo PNG" \ No newline at end of file