Skip to content

Commit 4e787e1

Browse files
author
Petrekanics Máté
committed
feature add language switcher and translations
1 parent 69a7fc9 commit 4e787e1

29 files changed

+624
-182
lines changed

app/Actions/Notifications/SendDatabaseTestNotification.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ public function handle(User $user)
1414
{
1515
$user->notify(
1616
Notification::make()
17-
->title('Test database notification received!')
18-
->body('You say pong')
17+
->title(__('translations.notifications.database.received'))
18+
->body(__('translations.notifications.database.pong'))
1919
->success()
2020
->toDatabase(),
2121
);
2222

2323
Notification::make()
24-
->title('Test database notification sent.')
25-
->body('I say ping')
24+
->title(__('translations.notifications.database.sent'))
25+
->body(__('translations.notifications.database.ping'))
2626
->success()
2727
->send();
2828
}

app/Actions/Notifications/SendDiscordTestNotification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function handle(array $webhooks)
1414
{
1515
if (! count($webhooks)) {
1616
Notification::make()
17-
->title('You need to add Discord urls!')
17+
->title(__('translations.notifications.discord.add'))
1818
->warning()
1919
->send();
2020

@@ -24,13 +24,13 @@ public function handle(array $webhooks)
2424
foreach ($webhooks as $webhook) {
2525
WebhookCall::create()
2626
->url($webhook['url'])
27-
->payload(['content' => '👋 Testing the Discord notification channel.'])
27+
->payload(['content' => __('translations.notifications.discord.payload')])
2828
->doNotSign()
2929
->dispatch();
3030
}
3131

3232
Notification::make()
33-
->title('Test Discord notification sent.')
33+
->title(__('translations.notifications.discord.sent'))
3434
->success()
3535
->send();
3636
}

app/Actions/Notifications/SendGotifyTestNotification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function handle(array $webhooks)
1414
{
1515
if (! count($webhooks)) {
1616
Notification::make()
17-
->title('You need to add Gotify urls!')
17+
->title(__('translations.notifications.gotfy.add'))
1818
->warning()
1919
->send();
2020

@@ -24,13 +24,13 @@ public function handle(array $webhooks)
2424
foreach ($webhooks as $webhook) {
2525
WebhookCall::create()
2626
->url($webhook['url'])
27-
->payload(['message' => '👋 Testing the Gotify notification channel.'])
27+
->payload(['message' => __('translations.notifications.gotfy.payload')])
2828
->doNotSign()
2929
->dispatch();
3030
}
3131

3232
Notification::make()
33-
->title('Test Gotify notification sent.')
33+
->title(__('translations.notifications.gotfy.sent'))
3434
->success()
3535
->send();
3636
}

app/Actions/Notifications/SendHealthCheckTestNotification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function handle(array $webhooks)
1414
{
1515
if (! count($webhooks)) {
1616
Notification::make()
17-
->title('You need to add HealthCheck.io urls!')
17+
->title(__('translations.notifications.health_check.add'))
1818
->warning()
1919
->send();
2020

@@ -24,13 +24,13 @@ public function handle(array $webhooks)
2424
foreach ($webhooks as $webhook) {
2525
WebhookCall::create()
2626
->url($webhook['url'])
27-
->payload(['message' => '👋 Testing the HealthCheck.io notification channel.'])
27+
->payload(['message' => __('translations.notifications.health_check.payload')])
2828
->doNotSign()
2929
->dispatch();
3030
}
3131

3232
Notification::make()
33-
->title('Test HealthCheck.io notification sent.')
33+
->title(__('translations.notifications.health_check.sent'))
3434
->success()
3535
->send();
3636
}

app/Actions/Notifications/SendMailTestNotification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function handle(array $recipients)
1515
{
1616
if (! count($recipients)) {
1717
Notification::make()
18-
->title('You need to add mail recipients!')
18+
->title(__('translations.notifications.mail.add'))
1919
->warning()
2020
->send();
2121

@@ -28,7 +28,7 @@ public function handle(array $recipients)
2828
}
2929

3030
Notification::make()
31-
->title('Test mail notification sent.')
31+
->title(__('translations.notifications.mail.sent'))
3232
->success()
3333
->send();
3434
}

app/Actions/Notifications/SendNtfyTestNotification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function handle(array $webhooks)
1414
{
1515
if (! count($webhooks)) {
1616
Notification::make()
17-
->title('You need to add ntfy urls!')
17+
->title(__('translations.notifications.ntfy.add'))
1818
->warning()
1919
->send();
2020

@@ -26,7 +26,7 @@ public function handle(array $webhooks)
2626
->url($webhook['url'])
2727
->payload([
2828
'topic' => $webhook['topic'],
29-
'message' => '👋 Testing the ntfy notification channel.',
29+
'message' => __('translations.notifications.ntfy.payload'),
3030
])
3131
->doNotSign();
3232

@@ -42,7 +42,7 @@ public function handle(array $webhooks)
4242
}
4343

4444
Notification::make()
45-
->title('Test ntfy notification sent.')
45+
->title(__('translations.notifications.ntfy.sent'))
4646
->success()
4747
->send();
4848
}

app/Actions/Notifications/SendPushoverTestNotification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function handle(array $webhooks)
1414
{
1515
if (! count($webhooks)) {
1616
Notification::make()
17-
->title('You need to add Pushover URLs!')
17+
->title(__('translations.notifications.pushover.add'))
1818
->warning()
1919
->send();
2020

@@ -27,14 +27,14 @@ public function handle(array $webhooks)
2727
->payload([
2828
'token' => $webhook['api_token'],
2929
'user' => $webhook['user_key'],
30-
'message' => '👋 Testing the Pushover notification channel.',
30+
'message' => __('translations.notifications.pushover.payload'),
3131
])
3232
->doNotSign()
3333
->dispatch();
3434
}
3535

3636
Notification::make()
37-
->title('Test Pushover notification sent.')
37+
->title(__('translations.notifications.pushover.sent'))
3838
->success()
3939
->send();
4040
}

app/Actions/Notifications/SendSlackTestNotification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function handle(array $webhooks)
1414
{
1515
if (! count($webhooks)) {
1616
Notification::make()
17-
->title('You need to add Slack URLs!')
17+
->title(__('translations.notifications.slack.add'))
1818
->warning()
1919
->send();
2020

@@ -24,13 +24,13 @@ public function handle(array $webhooks)
2424
foreach ($webhooks as $webhook) {
2525
WebhookCall::create()
2626
->url($webhook['url'])
27-
->payload(['text' => '👋 Testing the Slack notification channel.'])
27+
->payload(['text' => __('translations.notifications.slack.payload')])
2828
->doNotSign()
2929
->dispatch();
3030
}
3131

3232
Notification::make()
33-
->title('Test Slack notification sent.')
33+
->title(__('translations.notifications.slack.sent'))
3434
->success()
3535
->send();
3636
}

app/Actions/Notifications/SendTelegramTestNotification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function handle(array $recipients)
1515
{
1616
if (! count($recipients)) {
1717
Notification::make()
18-
->title('You need to add Telegram recipients!')
18+
->title(__('translations.notifications.telegram.add'))
1919
->warning()
2020
->send();
2121

@@ -28,7 +28,7 @@ public function handle(array $recipients)
2828
}
2929

3030
Notification::make()
31-
->title('Test Telegram notification sent.')
31+
->title(__('translations.notifications.telegram.sent'))
3232
->success()
3333
->send();
3434
}

app/Actions/Notifications/SendWebhookTestNotification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function handle(array $webhooks)
1717
{
1818
if (! count($webhooks)) {
1919
Notification::make()
20-
->title('You need to add webhook URLs!')
20+
->title(__('translations.notifications.webhook.add'))
2121
->warning()
2222
->send();
2323

@@ -32,7 +32,7 @@ public function handle(array $webhooks)
3232
->url($webhook['url'])
3333
->payload([
3434
'result_id' => Str::uuid(),
35-
'site_name' => 'Webhook Notification Testing',
35+
'site_name' => __('translations.notifications.webhook.payload'),
3636
'isp' => $fakeResult->data['isp'],
3737
'ping' => $fakeResult->ping,
3838
'download' => $fakeResult->download,
@@ -46,7 +46,7 @@ public function handle(array $webhooks)
4646
}
4747

4848
Notification::make()
49-
->title('Test webhook notification sent.')
49+
->title(__('translations.notifications.webhook.sent'))
5050
->success()
5151
->send();
5252
}

0 commit comments

Comments
 (0)