Skip to content

Commit d2a5ecb

Browse files
authored
feat: change lang of submition article in fr (#153)
1 parent 7d707d6 commit d2a5ecb

File tree

8 files changed

+23
-22
lines changed

8 files changed

+23
-22
lines changed

app/Console/Commands/NotifyPendingArticles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ public function handle(AnonymousNotifiable $notifiable): void
2323
$notifiable->notify(new PendingArticlesNotification($pendingArticles));
2424
}
2525
}
26-
}
26+
}

app/Console/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ protected function commands(): void
3131
{
3232
$this->load(__DIR__.'/Commands');
3333
}
34-
}
34+
}

app/Notifications/PendingArticlesNotification.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
use Illuminate\Bus\Queueable;
88
use Illuminate\Notifications\Notification;
9-
use Illuminate\Contracts\Queue\ShouldQueue;
109
use Illuminate\Database\Eloquent\Collection;
11-
use Illuminate\Notifications\Messages\MailMessage;
1210
use NotificationChannels\Telegram\TelegramChannel;
1311
use NotificationChannels\Telegram\TelegramMessage;
1412

1513
final class PendingArticlesNotification extends Notification
1614
{
1715
use Queueable;
1816

19-
public function __construct(public Collection $pendingArticles) {}
17+
public function __construct(public Collection $pendingArticles)
18+
{
19+
}
2020

2121
public function via(mixed $notifiable): array
2222
{
@@ -28,25 +28,24 @@ public function toTelegram(): TelegramMessage
2828
$message = $this->content();
2929

3030
return TelegramMessage::create()
31-
->to(config('services.telegram-bot-api.channel'))
32-
->content($message);
31+
->to(config('services.telegram-bot-api.channel'))->content($message);
3332
}
3433

3534
private function content(): string
3635
{
37-
$message = __("Pending approval articles:\n\n");
36+
$message = __("Articles soumis en attente d'approbation:\n\n");
3837
foreach ($this->pendingArticles as $article) {
3938
$message .= __(
40-
"[@:username](:profile_url) submitted the article [:title](:url) on: :date\n\n", [
39+
"[@:username](:profile_url) a soumit l'article [:title](:url) le: :date\n\n",
40+
[
4141
'username' => $article->user?->username,
4242
'profile_url' => route('profile', $article->user?->username),
4343
'title' => $article->title,
4444
'url' => route('articles.show', $article->slug),
45-
'date' => $article->submitted_at->translatedFormat('d/m/Y')
45+
'date' => $article->submitted_at->translatedFormat('d M Y')
4646
]
4747
);
4848
}
49-
5049
return $message;
5150
}
52-
}
51+
}

lang/en.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"Verify Email Address": "Verify Email Address",
55
"Please click the button below to verify your email address.": "Please click the button below to verify your email address.",
66
"If you did not create an account, no further action is required.": "If you did not create an account, no further action is required.",
7-
"Pending approval articles:" : "Pending approval articles:",
8-
"[@:username](:profile_url) submitted the article [:title](:url) on: :date" : "[@:username](:profile_url) submitted the article [:title](:url) on: :date"
9-
}
7+
"Articles soumis en attente d'approbation:" : "Pending approval articles:",
8+
"[@:username](:profile_url) a soumit l'article :title le: :date" : "[@:username](:profile_url) submitted the article :title on: :date",
9+
"Voir l'article" : "Voir l'article"
10+
}

lang/fr.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"Verify Email Address": "Vérifier l'adresse e-mail",
55
"Please click the button below to verify your email address.": "Veuillez cliquer sur le bouton ci-dessous pour vérifier votre adresse email.",
66
"If you did not create an account, no further action is required.": "Si vous n'avez pas créé de compte, aucune autre action n'est requise.",
7-
"Pending approval articles:" : "Articles soumis en attente d'approbation:",
8-
"[@:username](:profile_url) submitted the article [:title](:url) on: :date" : "[@:username](:profile_url) a soumit l'article [:title](:url) le: :date"
9-
}
7+
"Articles soumis en attente d'approbation:" : "Articles soumis en attente d'approbation:",
8+
"[@:username](:profile_url) a soumit l'article [:title](:url) le: :date" : "[@:username](:profile_url) a soumit l'article [:title](:url) le: :date",
9+
"Voir l'article": "Voir l'article"
10+
}

tests/Feature/NotifyPendingArticlesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use App\Models\Article;
77
use Illuminate\Support\Facades\Notification;
88

9-
beforeEach(fn() => Notification::fake());
9+
beforeEach(fn () => Notification::fake());
1010

1111
it('will send a notification when there are pending articles', function (): void {
1212
Article::factory()->createMany([
@@ -46,4 +46,4 @@
4646

4747
Notification::assertNothingSent();
4848
Notification::assertCount(0);
49-
});
49+
});

tests/Integration/DiscussionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@
6969

7070
// When providing a slug with invalid url characters, a random 5 character string is returned.
7171
expect($discussion->slug())->toMatch('/\w{5}/');
72-
});
72+
});

tests/Integration/ThreadTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,4 @@ function createActiveThread(): Thread
187187
$reply->save();
188188

189189
return $thread;
190-
}
190+
}

0 commit comments

Comments
 (0)