Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/Actions/Notifications/SendDatabaseTestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public function handle(User $user)
{
$user->notify(
Notification::make()
->title('Test database notification received!')
->body('You say pong')
->title(__('translations.notifications.database.received'))
->body(__('translations.notifications.database.pong'))
->success()
->toDatabase(),
);

Notification::make()
->title('Test database notification sent.')
->body('I say ping')
->title(__('translations.notifications.database.sent'))
->body(__('translations.notifications.database.ping'))
->success()
->send();
}
Expand Down
6 changes: 3 additions & 3 deletions app/Actions/Notifications/SendDiscordTestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add Discord urls!')
->title(__('translations.notifications.discord.add'))
->warning()
->send();

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

Notification::make()
->title('Test Discord notification sent.')
->title(__('translations.notifications.discord.sent'))
->success()
->send();
}
Expand Down
6 changes: 3 additions & 3 deletions app/Actions/Notifications/SendGotifyTestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add Gotify urls!')
->title(__('translations.notifications.gotfy.add'))
->warning()
->send();

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

Notification::make()
->title('Test Gotify notification sent.')
->title(__('translations.notifications.gotfy.sent'))
->success()
->send();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add HealthCheck.io urls!')
->title(__('translations.notifications.health_check.add'))
->warning()
->send();

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

Notification::make()
->title('Test HealthCheck.io notification sent.')
->title(__('translations.notifications.health_check.sent'))
->success()
->send();
}
Expand Down
4 changes: 2 additions & 2 deletions app/Actions/Notifications/SendMailTestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function handle(array $recipients)
{
if (! count($recipients)) {
Notification::make()
->title('You need to add mail recipients!')
->title(__('translations.notifications.mail.add'))
->warning()
->send();

Expand All @@ -28,7 +28,7 @@ public function handle(array $recipients)
}

Notification::make()
->title('Test mail notification sent.')
->title(__('translations.notifications.mail.sent'))
->success()
->send();
}
Expand Down
6 changes: 3 additions & 3 deletions app/Actions/Notifications/SendNtfyTestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add ntfy urls!')
->title(__('translations.notifications.ntfy.add'))
->warning()
->send();

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

Expand All @@ -42,7 +42,7 @@ public function handle(array $webhooks)
}

Notification::make()
->title('Test ntfy notification sent.')
->title(__('translations.notifications.ntfy.sent'))
->success()
->send();
}
Expand Down
6 changes: 3 additions & 3 deletions app/Actions/Notifications/SendPushoverTestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add Pushover URLs!')
->title(__('translations.notifications.pushover.add'))
->warning()
->send();

Expand All @@ -27,14 +27,14 @@ public function handle(array $webhooks)
->payload([
'token' => $webhook['api_token'],
'user' => $webhook['user_key'],
'message' => '👋 Testing the Pushover notification channel.',
'message' => __('translations.notifications.pushover.payload'),
])
->doNotSign()
->dispatch();
}

Notification::make()
->title('Test Pushover notification sent.')
->title(__('translations.notifications.pushover.sent'))
->success()
->send();
}
Expand Down
6 changes: 3 additions & 3 deletions app/Actions/Notifications/SendSlackTestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add Slack URLs!')
->title(__('translations.notifications.slack.add'))
->warning()
->send();

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

Notification::make()
->title('Test Slack notification sent.')
->title(__('translations.notifications.slack.sent'))
->success()
->send();
}
Expand Down
4 changes: 2 additions & 2 deletions app/Actions/Notifications/SendTelegramTestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function handle(array $recipients)
{
if (! count($recipients)) {
Notification::make()
->title('You need to add Telegram recipients!')
->title(__('translations.notifications.telegram.add'))
->warning()
->send();

Expand All @@ -28,7 +28,7 @@ public function handle(array $recipients)
}

Notification::make()
->title('Test Telegram notification sent.')
->title(__('translations.notifications.telegram.sent'))
->success()
->send();
}
Expand Down
6 changes: 3 additions & 3 deletions app/Actions/Notifications/SendWebhookTestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add webhook URLs!')
->title(__('translations.notifications.webhook.add'))
->warning()
->send();

Expand All @@ -32,7 +32,7 @@ public function handle(array $webhooks)
->url($webhook['url'])
->payload([
'result_id' => Str::uuid(),
'site_name' => 'Webhook Notification Testing',
'site_name' => __('translations.notifications.webhook.payload'),
'isp' => $fakeResult->data['isp'],
'ping' => $fakeResult->ping,
'download' => $fakeResult->download,
Expand All @@ -46,7 +46,7 @@ public function handle(array $webhooks)
}

Notification::make()
->title('Test webhook notification sent.')
->title(__('translations.notifications.webhook.sent'))
->success()
->send();
}
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/OoklaListServers.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function handle(): void
);

if ($response->failed()) {
$this->fail('There was an issue retrieving a list of speedtest servers, check the logs.');
$this->fail(__('translations.ookla_error'));
}

$fields = ['id', 'sponsor', 'name', 'country', 'distance'];
Expand Down
10 changes: 5 additions & 5 deletions app/Console/Commands/ResultFixStatuses.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public function handle(): void
{
$this->newLine();

$this->info('This will check each result and correct the status to "completed" or "failed" based on the data column.');
$this->info('📖 Read the docs: https://docs.speedtest-tracker.dev/other/commands');
$this->info(__('translations.status_fix.info_1'));
$this->info(__('translations.status_fix.info_2'));

if (! $this->confirm('Do you want to continue?')) {
$this->fail('Command cancelled.');
if (! $this->confirm(__('translations.confirm'))) {
$this->fail(__('translations.fail'));
}

/**
Expand Down Expand Up @@ -63,6 +63,6 @@ public function handle(): void
'status' => ResultStatus::Failed,
]);

$this->line('✅ finished!');
$this->line(__('translations.status_fix.finished'));
}
}
10 changes: 5 additions & 5 deletions app/Console/Commands/UserChangeRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class UserChangeRole extends Command
public function handle(): void
{
$email = text(
label: 'What is the email address?',
label: __('translations.user_change.what_is_the_email_address'),
required: true,
validate: fn (string $value) => match (true) {
! User::firstWhere('email', $value) => 'User not found.',
Expand All @@ -40,10 +40,10 @@ public function handle(): void
);

$role = select(
label: 'What role should the user have?',
label: __('translations.user_change.what_role'),
options: [
'admin' => 'Admin',
'user' => 'User',
'admin' => __('translations.Admin'),
'user' => __('translations.User'),
],
default: 'user'
);
Expand All @@ -53,6 +53,6 @@ public function handle(): void
'role' => $role,
]);

info('User role updated.');
info(__('translations.user_change.info'));
}
}
6 changes: 3 additions & 3 deletions app/Console/Commands/UserResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class UserResetPassword extends Command
public function handle(): void
{
$email = text(
label: 'What is the email address?',
label: __('translations.user_change.welcome_email'),
required: true,
validate: fn (string $value) => match (true) {
! User::firstWhere('email', $value) => 'User not found.',
Expand All @@ -41,7 +41,7 @@ public function handle(): void
);

$password = password(
label: 'What is the new password?',
label: __('translations.user_change.what_is_password'),
required: true,
);

Expand All @@ -50,6 +50,6 @@ public function handle(): void
'password' => Hash::make($password),
]);

info('The password for "'.$email.'" has been updated.');
info(__('translations.user_change.password_updated_info', ['email' => $email]));
}
}
2 changes: 1 addition & 1 deletion app/Enums/ResultService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ enum ResultService: string implements HasLabel

public function getLabel(): ?string
{
return Str::title($this->name);
return Str::title(__('translations.'.$this->name));
}
}
2 changes: 1 addition & 1 deletion app/Enums/ResultStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public function getColor(): ?string

public function getLabel(): ?string
{
return Str::title($this->name);
return Str::title(__('translations.'.$this->name));
}
}
2 changes: 1 addition & 1 deletion app/Enums/UserRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public function getColor(): ?string

public function getLabel(): ?string
{
return Str::title($this->name);
return Str::title(__('translations.'.$this->name));
}
}
27 changes: 19 additions & 8 deletions app/Filament/Exports/ResultExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ public function getFormats(): array
public static function getColumns(): array
{
$columns = [
ExportColumn::make('id')->label('ID'),
ExportColumn::make('id')
->label(__('translations.id')),
ExportColumn::make('service')->state(fn (Result $r) => $r->service->getLabel()),
ExportColumn::make('status')->state(fn (Result $r) => $r->status->getLabel()),
ExportColumn::make('scheduled')->state(fn (Result $r) => $r->scheduled ? 'Yes' : 'No'),
ExportColumn::make('healthy')->state(fn (Result $r) => $r->healthy ? 'Yes' : 'No'),
ExportColumn::make('created_at'),
ExportColumn::make('updated_at'),
ExportColumn::make('comments'),
ExportColumn::make('scheduled')->state(fn (Result $r) => $r->scheduled ? __('translations.yes') : __('translations.no')),
ExportColumn::make('healthy')->state(fn (Result $r) => $r->healthy ? __('translations.yes') : __('translations.no')),
ExportColumn::make('created_at')->label(__('translations.created_at')),
ExportColumn::make('updated_at')->label(__('translations.updated_at')),
ExportColumn::make('comments')->label(__('translations.comments')),
];

$columns = array_merge($columns, self::generateDataColumns());
Expand Down Expand Up @@ -78,10 +79,20 @@ protected static function flatten(array $array, string $prefix = ''): array

public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your result export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
$body = __('translations.export_completed', [
'count' => number_format($export->successful_rows),
'rows' => trans_choice('translations.row', $export->successful_rows, [
'count' => number_format($export->successful_rows),
]),
]);

if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
$body .= __('translations.failed_export', [
'count' => $failedRowsCount,
'rows' => trans_choice('translations.row', $export->$failedRowsCount, [
'count' => number_format($export->$failedRowsCount),
]),
]);
}

return $body;
Expand Down
Loading