Skip to content

Commit 4bd49e1

Browse files
committed
feat(translation): (LAR-86) add translation for UserResource
1 parent 00009db commit 4bd49e1

File tree

9 files changed

+86
-25
lines changed

9 files changed

+86
-25
lines changed

app/Filament/Resources/UserResource.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ public static function table(Table $table): Table
5656
->icon('untitledui-inbox')
5757
->description(fn ($record): ?string => $record->phone_number),
5858
Tables\Columns\TextColumn::make('email_verified_at')
59-
->label('Validation Email')
59+
->label(__('global.ban.label.validate_email'))
6060
->placeholder('N/A')
6161
->date(),
6262
Tables\Columns\TextColumn::make(name: 'created_at')
63-
->label('Inscription')
63+
->label(__('global.ban.label.inscription'))
6464
->date(),
6565
])
6666
->filters([
6767
Tables\Filters\TernaryFilter::make('email_verified_at')
68-
->label('Email Vérifiée')
68+
->label(__('global.ban.label.email_verified'))
6969
->nullable(),
7070
])
7171
->actions([
@@ -74,20 +74,20 @@ public static function table(Table $table): Table
7474
->icon('untitledui-archive')
7575
->color('warning')
7676
->visible(fn ($record) => $record->banned_at == null)
77-
->modalHeading(__('Bannir l\'utilisateur'))
78-
->modalDescription(__('Veuillez entrer la raison du bannissement.'))
77+
->modalHeading(__('global.ban.heading'))
78+
->modalDescription(__('global.ban.description'))
7979
->form([
8080

8181
TextInput::make('banned_reason')
82-
->label(__('Raison du bannissement'))
82+
->label(__('global.ban.reason'))
8383
->required(),
8484
])
8585
->action(function (User $record, array $data) {
8686
if (!self::canBanUser($record)) {
8787
Notification::make()
8888
->warning()
89-
->title(__('Impossible de bannir'))
90-
->body(__('Vous ne pouvez pas bannir un administrateur.'))
89+
->title(__('notifications.user.cannot.title'))
90+
->body(__('notifications.user.cannot.ban_admin'))
9191
->duration(5000)
9292
->send();
9393

@@ -126,8 +126,8 @@ public static function BanUserAction(User $record, $reason): void
126126
if ($record->banned_at !== null) {
127127
Notification::make()
128128
->warning()
129-
->title(__('Impossible de bannir'))
130-
->body(__('Cet utilisateur est déjà banni.'))
129+
->title(__('notifications.user.cannot.title'))
130+
->body(__('notifications.user.cannot.body'))
131131
->send();
132132

133133
return;
@@ -140,8 +140,8 @@ public static function BanUserAction(User $record, $reason): void
140140
Notification::make()
141141
->success()
142142
->duration(5000)
143-
->title(__('L\'utilisateur à été banni'))
144-
->body(__('L\'utilisateur à été notifier qu\'il à été banni'))
143+
->title(__('notifications.user.banned.title'))
144+
->body(__('notifications.user.banned.body'))
145145
->send();
146146

147147
event(new UserBannedEvent($record));
@@ -155,9 +155,9 @@ public static function UnbanUserAction(User $record): void
155155

156156
Notification::make()
157157
->success()
158-
->title(__('L\'utilisateur à été dé-banni'))
158+
->title(__('notifications.user.unbanned.title'))
159159
->duration(5000)
160-
->body(__('L\'utilisateur à été notifier qu\'il peut de nouveau se connecter'))
160+
->body(__('notifications.user.unbanned.body'))
161161
->send();
162162

163163
event(new UserUnbannedEvent($record));

app/Filament/Resources/UserResource/Pages/ListUsers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ final class ListUsers extends ListRecords
1515
public function getTabs() : array
1616
{
1717
return [
18-
__('Tout') => Tab::make('Tout'),
19-
__("Bannis") => Tab::make(__('Bannis'))
18+
__('global.ban.all') => Tab::make(__('global.ban.all')),
19+
__('global.ban.banned') => Tab::make(__('global.ban.banned'))
2020
->modifyQueryUsing(function ($query) {
2121
return $query->isBanned();
2222
}),
23-
__("Non Bannis") => Tab::make(__('Non Bannis'))
23+
__('global.ban.not_banned') => Tab::make(__('global.ban.not_banned'))
2424
->modifyQueryUsing(function ($query) {
2525
return $query->isNotBanned();
2626
}),

app/Http/Middleware/CheckIfBanned.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function handle(Request $request, Closure $next): Response
1717
Auth::logout();
1818

1919
return redirect()->route('login')->withErrors([
20-
'email' => __('Votre compte a été banni. Contactez l\'administrateur pour plus d\'informations.'),
20+
'email' => __('global.ban.message'),
2121
]);
2222
}
2323

app/Mail/UserBannedEMail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(public User $user){}
2121
public function envelope(): Envelope
2222
{
2323
return new Envelope(
24-
subject: __('Notification de bannissement Laravelcm'),
24+
subject: __('global.ban.ban_email_subject'),
2525
);
2626
}
2727

app/Mail/UserUnBannedEMail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(public User $user){}
2121
public function envelope(): Envelope
2222
{
2323
return new Envelope(
24-
subject: __('Notification de dé-baannissement Laravelcm'),
24+
subject: __('global.ban.unban_email_subject'),
2525
);
2626
}
2727

lang/en/global.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,20 @@
9090
'discussion_description' => 'Discuss and debate different themes and ideas',
9191
],
9292
'moderator' => 'Moderator',
93-
94-
];
93+
'ban' => [
94+
'reason' => 'Reason for banning',
95+
'heading' => 'Ban the user',
96+
'description' => 'Please enter the reason for banning.',
97+
'all' => 'All',
98+
'banned' => 'Banned',
99+
'not_banned' => 'Not banned',
100+
'ban_email_subject' => 'Laravelcm ban notification',
101+
'unban_email_subject' => 'Laravelcm unbanning notification',
102+
'message' => 'Your account has been banned. Contact the administrator for more information.',
103+
'label' => [
104+
'email_verified' => 'Email verified',
105+
'inscription' => 'Inscription',
106+
'validate_email' => 'Validation Email'
107+
],
108+
],
109+
];

lang/en/notifications.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,19 @@
3030

3131
'error' => 'Oops! You\'ve got errors.',
3232

33-
];
33+
'user' => [
34+
'banned' => [
35+
'title' => 'The user has been banned.',
36+
'body' => 'The user has been notified that he has been banned'
37+
],
38+
'unbanned' => [
39+
'title' => 'The user has been un-banned',
40+
'body' => 'The user has been notified that he can log in again.'
41+
],
42+
'cannot' => [
43+
'title' => 'Unable to ban',
44+
'body' => 'This user is already banned.',
45+
'ban_admin' => 'You cannot ban an administrator.',
46+
]
47+
]
48+
];

lang/fr/global.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,21 @@
9090
'discussion_description' => 'Échangez, débattez sur différentes thématiques et idées.',
9191
],
9292
'moderator' => 'Modérateur',
93+
'ban' => [
94+
'reason' => 'Raison du bannissement',
95+
'heading' => 'Bannir l\'utilisateur',
96+
'description' => 'Veuillez entrer la raison du bannissement.',
97+
'all' => 'Tout',
98+
'banned' => 'Bannis',
99+
'not_banned' => 'Non bannis',
100+
'ban_email_subject' => 'Notification de bannissement Laravelcm',
101+
'unban_email_subject' => 'Notification de dé-baannissement Laravelcm',
102+
'message' => 'Votre compte a été banni. Contactez l\'administrateur pour plus d\'informations.',
103+
'label' => [
104+
'email_verified' => 'Email verified',
105+
'inscription' => 'Inscription',
106+
'validate_email' => 'Validation Email'
107+
],
108+
]
93109

94-
];
110+
];

lang/fr/notifications.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,19 @@
3030

3131
'error' => 'Oups! Nous avons rencontré des erreurs.',
3232

33-
];
33+
'user' => [
34+
'banned' => [
35+
'title' => 'L\'utilisateur à été banni.',
36+
'body' => 'L\'utilisateur à été notifier qu\'il à été banni'
37+
],
38+
'unbanned' => [
39+
'title' => 'L\'utilisateur à été dé-banni',
40+
'body' => 'L\'utilisateur à été notifier qu\'il peut de nouveau se connecter'
41+
],
42+
'cannot' => [
43+
'title' => 'Impossible de bannir',
44+
'body' => 'Cet utilisateur est déjà banni.',
45+
'ban_admin' => 'Vous ne pouvez pas bannir un administrateur.',
46+
]
47+
]
48+
];

0 commit comments

Comments
 (0)