Skip to content

Commit

Permalink
more missing translations found (#2043)
Browse files Browse the repository at this point in the history
  • Loading branch information
amazingphilippe authored Jan 10, 2025
1 parent a765efd commit 32efdc7
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 36 deletions.
62 changes: 31 additions & 31 deletions app/main/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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")),
],
)

Expand Down Expand Up @@ -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],
)

Expand All @@ -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"),
),
),
)
Expand All @@ -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):
Expand Down
9 changes: 5 additions & 4 deletions app/main/views/platform_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h1 class="heading-medium">{{ _("Settings") }}</h1>
}}
{% 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'),
Expand Down
33 changes: 33 additions & 0 deletions app/translations/csv/fr.csv
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@
"address","adresse"
"addresses","adresses"
"Template","Gabarit"
"Template Category","Catégorie de gabarit"
"template","gabarit"
"Delete","Supprimer"
"Back","Retour"
Expand Down Expand Up @@ -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é"
Expand Down Expand Up @@ -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?"
Expand Down Expand Up @@ -2070,3 +2077,29 @@
"For more information, visit <a href={}>usage reports</a>.","Pour plus de détails, <a href={}>consulter les rapports d’utilisation</a>."
"{} cannot send any more {} until April 1, {}","{} ne peut plus envoyer de {} d’ici le 1<sup>er</sup> 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"

0 comments on commit 32efdc7

Please sign in to comment.