Skip to content

Commit 116f83a

Browse files
Crowdin support for translations (alexjustesen#2410)
Co-authored-by: Alex Justesen <[email protected]>
1 parent c893fc7 commit 116f83a

File tree

95 files changed

+814
-3424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+814
-3424
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ body:
1111
Please note:
1212
- For **feature requests or changes**, use the [feature request form](https://github.com/alexjustesen/speedtest-tracker/issues/new?template=feature_request.yml).
1313
- For **general questions**, **setup or configuration help**, or if you’re not sure this is a bug, please use **[GitHub Discussions](https://github.com/alexjustesen/speedtest-tracker/discussions)** instead.
14+
- Any isseus with translations should be reported/solved within the [crowdin project](https://crowdin.com/project/speedtest-tracker).
1415
- type: checkboxes
1516
attributes:
1617
label: Pre-work

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ body:
77
attributes:
88
value: |
99
You should only use this form to request a change or new feature, to report a bug or issue use the [bug report form](https://github.com/alexjustesen/speedtest-tracker).
10+
Any reqeusts for new translations should be reqeusted within the [crowdin project](https://crowdin.com/project/speedtest-tracker).
1011
- type: checkboxes
1112
attributes:
1213
label: Pre-work

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Speedtest Tracker is a self-hosted application that monitors the performance and
1010
- **Detailed Metrics**: Capture download and upload speeds, ping, packet loss and more.
1111
- **Historical Data**: View historical data and trends to identify patterns and issues with your internet connection.
1212
- **Notifications**: Receive notifications when your internet performance drops below a certain threshold.
13+
- **Multi-Language Support**: Available in multiple languages with community translations via [Crowdin](https://crowdin.com/project/speedtest-tracker).
1314

1415
## Getting Started
1516

@@ -20,4 +21,12 @@ Speedtest Tracker is containerized so you can run it anywhere you run your conta
2021
- [Notifications](https://docs.speedtest-tracker.dev/settings/notifications) channels alert you when issues happen.
2122
- [Frequently Asked Questions](https://docs.speedtest-tracker.dev/help/faqs) are common questions that can help you resolve issues.
2223

24+
## Translations
25+
26+
Speedtest Tracker supports multiple languages thanks to our community translators!
27+
28+
**Request a new language**: Visit our [Crowdin project](https://crowdin.com/project/speedtest-tracker) and request a new language directly in crowdin.
29+
30+
**Help translate**: Join our [Crowdin project](https://crowdin.com/project/speedtest-tracker) to contribute translations in your language. All translation levels are welcome!
31+
2332
[![Star History Chart](https://api.star-history.com/svg?repos=alexjustesen/speedtest-tracker&type=Date)](https://star-history.com/#alexjustesen/speedtest-tracker&Date)

app/Actions/Notifications/SendDatabaseTestNotification.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@ class SendDatabaseTestNotification
1212

1313
public function handle(User $user)
1414
{
15-
$user->notify(
16-
Notification::make()
17-
->title('Test database notification received!')
18-
->body('You say pong')
19-
->success()
20-
->toDatabase(),
21-
);
15+
Notification::make()
16+
->title(__('settings/notifications.test_notifications.database.received'))
17+
->body(__('settings/notifications.test_notifications.database.pong'))
18+
->success()
19+
->sendToDatabase($user);
2220

2321
Notification::make()
24-
->title('Test database notification sent.')
25-
->body('I say ping')
22+
->title(__('settings/notifications.test_notifications.database.sent'))
23+
->body(__('settings/notifications.test_notifications.database.ping'))
2624
->success()
2725
->send();
2826
}

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(__('settings/notifications.test_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(__('settings/notifications.test_notifications.mail.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(__('settings/notifications.test_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' => __('settings/notifications.test_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(__('settings/notifications.test_notifications.webhook.sent'))
5050
->success()
5151
->send();
5252
}

app/Enums/ResultService.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace App\Enums;
44

55
use Filament\Support\Contracts\HasLabel;
6-
use Illuminate\Support\Str;
76

87
enum ResultService: string implements HasLabel
98
{
@@ -12,6 +11,9 @@ enum ResultService: string implements HasLabel
1211

1312
public function getLabel(): ?string
1413
{
15-
return Str::title($this->name);
14+
return match ($this) {
15+
self::Faker => __('enums.service.faker'),
16+
self::Ookla => __('enums.service.ookla'),
17+
};
1618
}
1719
}

app/Enums/ResultStatus.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Filament\Support\Contracts\HasColor;
66
use Filament\Support\Contracts\HasLabel;
7-
use Illuminate\Support\Str;
87

98
enum ResultStatus: string implements HasColor, HasLabel
109
{
@@ -33,6 +32,15 @@ public function getColor(): ?string
3332

3433
public function getLabel(): ?string
3534
{
36-
return Str::title($this->name);
35+
return match ($this) {
36+
self::Benchmarking => __('enums.status.benchmarking'),
37+
self::Checking => __('enums.status.checking'),
38+
self::Completed => __('enums.status.completed'),
39+
self::Failed => __('enums.status.failed'),
40+
self::Running => __('enums.status.running'),
41+
self::Started => __('enums.status.started'),
42+
self::Skipped => __('enums.status.skipped'),
43+
self::Waiting => __('enums.status.waiting'),
44+
};
3745
}
3846
}

app/Enums/UserRole.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Filament\Support\Contracts\HasColor;
66
use Filament\Support\Contracts\HasLabel;
7-
use Illuminate\Support\Str;
87

98
enum UserRole: string implements HasColor, HasLabel
109
{
@@ -21,6 +20,9 @@ public function getColor(): ?string
2120

2221
public function getLabel(): ?string
2322
{
24-
return Str::title($this->name);
23+
return match ($this) {
24+
self::Admin => __('general.admin'),
25+
self::User => __('general.user'),
26+
};
2527
}
2628
}

app/Filament/Pages/Dashboard.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,29 @@ class Dashboard extends BasePage
1919

2020
protected string $view = 'filament.pages.dashboard';
2121

22+
public function getTitle(): string
23+
{
24+
return __('dashboard.title');
25+
}
26+
27+
public static function getNavigationLabel(): string
28+
{
29+
return __('dashboard.title');
30+
}
31+
2232
public function getSubheading(): ?string
2333
{
2434
$schedule = config('speedtest.schedule');
2535

2636
if (blank($schedule) || $schedule === false) {
27-
return __('No speedtests scheduled.');
37+
return __('dashboard.no_speedtests_scheduled');
2838
}
2939

3040
$cronExpression = new CronExpression($schedule);
3141

3242
$nextRunDate = Carbon::parse($cronExpression->getNextRunDate(timeZone: config('app.display_timezone')))->format(config('app.datetime_format'));
3343

34-
return 'Next speedtest at: '.$nextRunDate;
44+
return __('dashboard.next_speedtest_at').': '.$nextRunDate;
3545
}
3646

3747
protected function getHeaderWidgets(): array

0 commit comments

Comments
 (0)