Skip to content

Commit 71c3603

Browse files
committed
fix: add missing translations
Issue: #488
1 parent a72cc98 commit 71c3603

6 files changed

Lines changed: 30 additions & 14 deletions

File tree

app/src/Controller/ImportController.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\Routing\Attribute\Route;
18+
use Symfony\Component\Translation\TranslatableMessage;
1819
use Symfony\Contracts\Translation\TranslatorInterface;
1920

2021
use function dd;
@@ -56,10 +57,10 @@ public function index(Request $request): Response
5657
$message = str_replace('[NB_USER]', strval($result['user_import']), $message);
5758
$this->addFlash('success', $message);
5859
} else {
59-
$this->addFlash('warning', 'Generics.flash.NoImport');
60+
$this->addFlash('warning', new TranslatableMessage('Generics.flash.NoImport'));
6061
}
6162
} else {
62-
$this->addFlash('danger', 'Generics.flash.BadFormatcsv');
63+
$this->addFlash('danger', new TranslatableMessage('Generics.flash.BadCsvFormat'));
6364
}
6465

6566
return $this->redirect($this->referrer->get());
@@ -247,10 +248,10 @@ public function indexAlias(Request $request): Response
247248
$message = str_replace('[NB_USER]', strval($result['user_import']), $message);
248249
$this->addFlash('success', $message);
249250
} else {
250-
$this->addFlash('warning', 'Generics.flash.NoImport');
251+
$this->addFlash('warning', new TranslatableMessage('Generics.flash.NoImport'));
251252
}
252253
} else {
253-
$this->addFlash('danger', 'Generics.flash.BadFormatcsv');
254+
$this->addFlash('danger', new TranslatableMessage('Generics.flash.BadCsvFormat'));
254255
}
255256

256257
return $this->redirect($this->referrer->get());

app/src/Controller/WblistController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function importWbListAction(Request $request, string $type): Response
209209
$file = $fileUpload->move('/tmp/', $filename);
210210
$this->importWbList($file->getPathname(), $form->get('domain')->getData(), $rule);
211211
} else {
212-
$this->addFlash('danger', 'Generics.flash.BadFormatcsv');
212+
$this->addFlash('danger', new TranslatableMessage('Generics.flash.BadImportFormat'));
213213
}
214214

215215
return new RedirectResponse($this->referrer->get());

app/templates/header.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
{% endif %}
6565

6666
{% if sharedBoxes|length > 0%}
67-
<div class="dropdown-header">Autres boîtes mails</div>
67+
<div class="dropdown-header">{{ 'Navigation.mailboxes.other' | trans }}</div>
6868

6969
{% for sharedBox in sharedBoxes %}
7070
<a class="dropdown-item" href="{{ path('homepage', {'_switch_user': sharedBox.username}) }}" title="{{ 'Generics.actions.connectAs'|trans() ~ sharedBox.username}}">

app/translations/messages+intl-icu.en.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,16 @@ Generics.fields.object: Subject
325325
Generics.fields.priority: Priority
326326
Generics.fields.recipient: Recipient
327327
Generics.fields.sender: Sender
328+
Generics.flash.BadCsvFormat: 'Invalid CSV file'
329+
Generics.flash.BadImportFormat: 'Invalid import file format'
328330
Generics.flash.ExistingUser: 'Row [ROW] : User [EMAIL] already exist and is not an alias.'
329-
Generics.flash.ImportError: 'An error occurred during import: [ERROR_MESSAGE]'
330-
Generics.flash.ImportErrorsList: 'Errors occurred during import: <br> [LIST_ROWS_ERROR]'
331-
Generics.flash.ImportExisting: 'The following users already existed and were updated : <br> [LIST_DUPES]'
331+
Generics.flash.ImportError: 'An error occurred during import: {ERROR_MESSAGE}'
332+
Generics.flash.ImportErrorsList: 'Errors occurred during import: <br> {LIST_ROWS_ERROR}'
333+
Generics.flash.ImportExisting: 'The following users already existed and were updated : <br> {LIST_DUPES}'
332334
Generics.flash.ImportSuccess: 'There are [NB_USER] email accounts that have been successfully imported!'
333335
Generics.flash.IncorrectColumns: 'Row [ROW]: Incorrect number of columns.'
334336
Generics.flash.InvalidEmail: 'Row [ROW]: email address is invalid.'
337+
Generics.flash.NoImport: 'Nothing has been imported'
335338
Generics.flash.NonexistantDomain: 'Row [ROW]: Domain [DOMAIN] does not exist in the database.'
336339
Generics.flash.NonexistantUser: 'Row [ROW]: User [EMAIL] does not exist in the database.'
337340
Generics.flash.accountUpdated: 'Account updated'
@@ -410,7 +413,6 @@ Message.Dialogs.confirmBannedMsgContent: 'Are you sure you want to ban the sende
410413
Message.Dialogs.confirmBannedMsgtitle: 'Ban the sender'
411414
Message.Dialogs.confirmDeleteDomainContent: 'Are you sure you want to delete this domain?'
412415
Message.Dialogs.confirmDeleteGroupContent: 'Are you sure you want to delete this group?'
413-
Message.Dialogs.confirmDeleteGroupTitle: 'Delete this group?'
414416
Message.Dialogs.confirmDeleteMsgContent: 'Are you sure you want to delete the message?'
415417
Message.Dialogs.confirmDeleteMsgtitle: 'Delete the message'
416418
Message.Dialogs.confirmDeleteSenderContentB: 'Are you sure you want to cancel ban for this sender?'
@@ -483,6 +485,7 @@ Navigation.information: Information
483485
Navigation.login: Connection
484486
Navigation.logout: Disconnect
485487
Navigation.mailBlocked: 'Mail blocked'
488+
Navigation.mailboxes.other: 'Other mailboxes'
486489
Navigation.mainSubTitle: 'Antispam solution AgentJ'
487490
Navigation.policy: Policies
488491
Navigation.poweredBy: 'Powered by Agentj'

app/translations/messages+intl-icu.fr.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,16 @@ Generics.fields.object: Objet
325325
Generics.fields.priority: Priorité
326326
Generics.fields.recipient: Destinataire
327327
Generics.fields.sender: Expéditeur
328+
Generics.flash.BadCsvFormat: 'Fichier CSV invalide'
329+
Generics.flash.BadImportFormat: "Format du fichier d'import invalide"
328330
Generics.flash.ExistingUser: "Ligne [ROW] : Utilisateur [EMAIL] existe déjà dans la base de données et n'est pas un alias."
329-
Generics.flash.ImportError: "Une erreur s'est produite lors de l'importation : [ERROR_MESSAGE]"
330-
Generics.flash.ImportErrorsList: "Des erreurs se sont produites lors de l'importation : <br> [LIST_ROWS_ERROR]"
331-
Generics.flash.ImportExisting: 'Les utilisateurs suivants existaient déjà dans la base de données et ont été mis à jours : <br> [LIST_DUPES]'
331+
Generics.flash.ImportError: "Une erreur s'est produite lors de l'importation : {ERROR_MESSAGE}"
332+
Generics.flash.ImportErrorsList: "Des erreurs se sont produites lors de l'importation : <br> {LIST_ROWS_ERROR}"
333+
Generics.flash.ImportExisting: 'Les utilisateurs suivants existaient déjà dans la base de données et ont été mis à jours : <br> {LIST_DUPES}'
332334
Generics.flash.ImportSuccess: 'Il y a [NB_USER] comptes emails qui ont été importés avec succès !'
333335
Generics.flash.IncorrectColumns: 'Ligne [ROW] : Nombre de colonnes incorrect.'
334336
Generics.flash.InvalidEmail: 'Ligne [ROW] : Adresse e-mail invalide.'
337+
Generics.flash.NoImport: "Rien n'a été importé"
335338
Generics.flash.NonexistantDomain: "Ligne [ROW] : Domaine [DOMAIN] n'existe pas dans la base de données."
336339
Generics.flash.NonexistantUser: "Ligne [ROW] : Utilisateur [EMAIL] n'existe pas dans la base de données."
337340
Generics.flash.accountUpdated: 'Compte mis à jour'
@@ -410,7 +413,6 @@ Message.Dialogs.confirmBannedMsgContent: "Êtes-vous sur de vouloir bannir l'exp
410413
Message.Dialogs.confirmBannedMsgtitle: "Bannir l'expéditeur"
411414
Message.Dialogs.confirmDeleteDomainContent: 'Êtes-vous sur de vouloir supprimer ce domaine ?'
412415
Message.Dialogs.confirmDeleteGroupContent: 'Êtes-vous sûr de vouloir supprimer ce groupe ?'
413-
Message.Dialogs.confirmDeleteGroupTitle: 'Supprimer ce groupe ?'
414416
Message.Dialogs.confirmDeleteMsgContent: 'Êtes-vous sur de vouloir supprimer le message ?'
415417
Message.Dialogs.confirmDeleteMsgtitle: 'Supprimer le message'
416418
Message.Dialogs.confirmDeleteSenderContentB: 'Êtes-vous sur de vouloir annuler le blocage pour cet expéditeur ?'
@@ -483,6 +485,7 @@ Navigation.information: Informations
483485
Navigation.login: Connexion
484486
Navigation.logout: 'Se déconnecter'
485487
Navigation.mailBlocked: 'Mails bloqués'
488+
Navigation.mailboxes.other: 'Autres boîtes mails'
486489
Navigation.mainSubTitle: 'Solution antispam AgentJ'
487490
Navigation.policy: Stratégies
488491
Navigation.poweredBy: 'Propulsé par Agentj'

create.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
# -*- coding: UTF8 -*-
3+
4+
#for i in {$1..$2}
5+
for i in seq $1 $2
6+
do
7+
printf "insert into groups (name, policy_id, domain_id,wb,slug) values ('test%d',5,3,'','test%d');" $i, $i
8+
#./scripts/mariadb agentj -e "insert into groups (name, policy_id, domain_id,wb,slug) values ('test$i',5,3,'','test$i');"
9+
done

0 commit comments

Comments
 (0)