From 895796429c7203d82ff93c6a5196731d7a602122 Mon Sep 17 00:00:00 2001 From: jnk0 <3634281+jnk0@users.noreply.github.com> Date: Mon, 9 Nov 2026 11:32:23 +0100 Subject: [PATCH 1/3] Translate affected components label on status page The incident and schedule components used __('Affected Components') and a hardcoded ' and ' when listing components. The package ships no JSON translations, so both stayed English in every locale. Use the existing incident.affected_components_header key and add a cachet.and key for the conjunction. --- resources/lang/de/cachet.php | 1 + resources/lang/de_AT/cachet.php | 1 + resources/lang/de_CH/cachet.php | 1 + resources/lang/en/cachet.php | 1 + resources/views/components/incident.blade.php | 4 ++-- resources/views/components/schedule.blade.php | 2 +- tests/Feature/StatusPage/SchedulePageTest.php | 21 +++++++++++++++++++ tests/Feature/StatusPage/StatusPageTest.php | 18 ++++++++++++++++ 8 files changed, 46 insertions(+), 3 deletions(-) diff --git a/resources/lang/de/cachet.php b/resources/lang/de/cachet.php index 91081fda..1a45935e 100644 --- a/resources/lang/de/cachet.php +++ b/resources/lang/de/cachet.php @@ -18,4 +18,5 @@ 'open_source_status_page' => 'Die Open-Source-Statusseite.', 'all_times_shown_in' => 'Alle Zeiten werden angezeigt in *:timezone*.', 'rss_feed' => ':name RSS-Feed', + 'and' => 'und', ]; diff --git a/resources/lang/de_AT/cachet.php b/resources/lang/de_AT/cachet.php index 91081fda..1a45935e 100644 --- a/resources/lang/de_AT/cachet.php +++ b/resources/lang/de_AT/cachet.php @@ -18,4 +18,5 @@ 'open_source_status_page' => 'Die Open-Source-Statusseite.', 'all_times_shown_in' => 'Alle Zeiten werden angezeigt in *:timezone*.', 'rss_feed' => ':name RSS-Feed', + 'and' => 'und', ]; diff --git a/resources/lang/de_CH/cachet.php b/resources/lang/de_CH/cachet.php index 91081fda..1a45935e 100644 --- a/resources/lang/de_CH/cachet.php +++ b/resources/lang/de_CH/cachet.php @@ -18,4 +18,5 @@ 'open_source_status_page' => 'Die Open-Source-Statusseite.', 'all_times_shown_in' => 'Alle Zeiten werden angezeigt in *:timezone*.', 'rss_feed' => ':name RSS-Feed', + 'and' => 'und', ]; diff --git a/resources/lang/en/cachet.php b/resources/lang/en/cachet.php index 50555621..30f3f8fe 100644 --- a/resources/lang/en/cachet.php +++ b/resources/lang/en/cachet.php @@ -18,4 +18,5 @@ 'open_source_status_page' => 'The open source status page.', 'all_times_shown_in' => 'All times are shown in *:timezone*.', 'rss_feed' => ':name RSS feed', + 'and' => 'and', ]; diff --git a/resources/views/components/incident.blade.php b/resources/views/components/incident.blade.php index ab8183e1..9c30e36a 100644 --- a/resources/views/components/incident.blade.php +++ b/resources/views/components/incident.blade.php @@ -52,7 +52,7 @@ class="text-zinc-400 transition hover:text-zinc-700 dark:text-zinc-500 dark:hove @if ($incident->components->isNotEmpty())
- {{ __('Affected Components') }}: {{ $incident->components->pluck('name')->join(', ', ' and ') }} + {{ __('cachet::incident.affected_components_header') }}: {{ $incident->components->pluck('name')->join(', ', ' '.__('cachet::cachet.and').' ') }}
@endif @@ -122,7 +122,7 @@ class="group relative rounded-lg bg-white shadow-sm ring-1 ring-zinc-900/10 dark @if ($schedule->components->isNotEmpty())
- {{ __('Affected Components') }}: {{ $schedule->components->pluck('name')->join(', ', ' and ') }} + {{ __('cachet::incident.affected_components_header') }}: {{ $schedule->components->pluck('name')->join(', ', ' '.__('cachet::cachet.and').' ') }}
@endif diff --git a/resources/views/components/schedule.blade.php b/resources/views/components/schedule.blade.php index 15a72c36..36adf684 100644 --- a/resources/views/components/schedule.blade.php +++ b/resources/views/components/schedule.blade.php @@ -33,7 +33,7 @@ @if ($schedule->components->isNotEmpty())
- {{ __('Affected Components') }}: {{ $schedule->components->pluck('name')->join(', ', ' and ') }} + {{ __('cachet::incident.affected_components_header') }}: {{ $schedule->components->pluck('name')->join(', ', ' '.__('cachet::cachet.and').' ') }}
@endif diff --git a/tests/Feature/StatusPage/SchedulePageTest.php b/tests/Feature/StatusPage/SchedulePageTest.php index cb276a2c..ea7139cf 100644 --- a/tests/Feature/StatusPage/SchedulePageTest.php +++ b/tests/Feature/StatusPage/SchedulePageTest.php @@ -2,9 +2,12 @@ namespace Tests\Feature\StatusPage; +use Cachet\Enums\ComponentStatusEnum; use Cachet\Enums\IncidentStatusEnum; +use Cachet\Models\Component; use Cachet\Models\Schedule; use Cachet\Models\Update; +use Cachet\Settings\AppSettings; use function Pest\Laravel\get; @@ -27,6 +30,24 @@ ->assertSee('Maintenance window confirmed.'); }); +it('translates the affected components label', function () { + $settings = app(AppSettings::class); + $settings->locale = 'de'; + $settings->save(); + + $database = Component::factory()->create(['name' => 'Database']); + $website = Component::factory()->create(['name' => 'Website']); + $schedule = Schedule::factory()->create(['scheduled_at' => now()->addDay()]); + $schedule->components()->attach([$database->id, $website->id], [ + 'component_status' => ComponentStatusEnum::under_maintenance, + ]); + + get(route('cachet.status-page.schedule', ['schedule' => $schedule])) + ->assertOk() + ->assertSee('Betroffene Komponenten: Database und Website') + ->assertDontSee('Affected Components'); +}); + it('links to schedules from the status page', function () { $schedule = Schedule::factory()->create(['scheduled_at' => now()->addDay()]); diff --git a/tests/Feature/StatusPage/StatusPageTest.php b/tests/Feature/StatusPage/StatusPageTest.php index 12df8be7..e812b472 100644 --- a/tests/Feature/StatusPage/StatusPageTest.php +++ b/tests/Feature/StatusPage/StatusPageTest.php @@ -544,6 +544,24 @@ function systemStatusGroupPattern(ComponentGroup $group, bool $open): string expect(app()->getLocale())->toBe('de'); }); +it('translates the affected components label of incidents', function () { + $settings = app(AppSettings::class); + $settings->locale = 'de'; + $settings->save(); + + $api = Component::factory()->create(['name' => 'API']); + $website = Component::factory()->create(['name' => 'Website']); + $incident = Incident::factory()->create(['status' => IncidentStatusEnum::investigating]); + $incident->components()->attach([$api->id, $website->id], [ + 'component_status' => ComponentStatusEnum::major_outage, + ]); + + $this->get(route('cachet.status-page')) + ->assertOk() + ->assertSee('Betroffene Komponenten: API und Website') + ->assertDontSee('Affected Components'); +}); + it('does not error when the from query parameter is malformed', function () { $this->get(route('cachet.status-page', ['from' => '2024-04-15/'])) ->assertOk(); From 7da1f703357bbba0c094e3ab84fb539dcf98e70d Mon Sep 17 00:00:00 2001 From: jnk0 <3634281+jnk0@users.noreply.github.com> Date: Wed, 11 Nov 2026 14:03:55 +0100 Subject: [PATCH 2/3] Translate remaining hardcoded labels The reported label on the status page and several dashboard labels used plain strings such as __('Reported') or fixed English text. The package ships no JSON translations, so they stayed English in every locale. Use existing package keys where available and add an update language file for the updates relation manager shared by incidents and schedules, plus a metric suffix placeholder key. --- resources/lang/de/metric.php | 1 + resources/lang/de/update.php | 20 +++++++++++++ resources/lang/de_AT/metric.php | 1 + resources/lang/de_AT/update.php | 20 +++++++++++++ resources/lang/de_CH/metric.php | 1 + resources/lang/de_CH/update.php | 20 +++++++++++++ resources/lang/en/metric.php | 1 + resources/lang/en/update.php | 20 +++++++++++++ resources/views/components/incident.blade.php | 4 +-- .../ComponentsRelationManager.php | 2 +- .../Resources/Incidents/IncidentResource.php | 2 +- .../Resources/Metrics/MetricResource.php | 2 +- .../UpdatesRelationManager.php | 30 +++++++++---------- .../Resources/IncidentResourceTest.php | 16 ++++++++++ tests/Feature/StatusPage/StatusPageTest.php | 17 +++++++++++ 15 files changed, 137 insertions(+), 20 deletions(-) create mode 100644 resources/lang/de/update.php create mode 100644 resources/lang/de_AT/update.php create mode 100644 resources/lang/de_CH/update.php create mode 100644 resources/lang/en/update.php diff --git a/resources/lang/de/metric.php b/resources/lang/de/metric.php index 5474e415..1897ac7e 100644 --- a/resources/lang/de/metric.php +++ b/resources/lang/de/metric.php @@ -26,6 +26,7 @@ 'form' => [ 'name_label' => 'Name', 'suffix_label' => 'Suffix', + 'suffix_placeholder' => 'z. B. ms, %, usw.', 'description_label' => 'Beschreibung', 'default_view_label' => 'Standardansicht', 'default_value_label' => 'Standardwert', diff --git a/resources/lang/de/update.php b/resources/lang/de/update.php new file mode 100644 index 00000000..ed2ddace --- /dev/null +++ b/resources/lang/de/update.php @@ -0,0 +1,20 @@ + 'Update|Updates', + 'list' => [ + 'headers' => [ + 'message' => 'Nachricht', + 'status' => 'Status', + 'user' => 'Benutzer', + 'created_at' => 'Erstellt am', + 'updated_at' => 'Aktualisiert am', + ], + ], + 'form' => [ + 'message_label' => 'Nachricht', + 'user_label' => 'Benutzer', + 'user_helper' => 'Benutzer, welcher den Vorfall gemeldet hat.', + 'status_label' => 'Status', + ], +]; diff --git a/resources/lang/de_AT/metric.php b/resources/lang/de_AT/metric.php index 5474e415..1897ac7e 100644 --- a/resources/lang/de_AT/metric.php +++ b/resources/lang/de_AT/metric.php @@ -26,6 +26,7 @@ 'form' => [ 'name_label' => 'Name', 'suffix_label' => 'Suffix', + 'suffix_placeholder' => 'z. B. ms, %, usw.', 'description_label' => 'Beschreibung', 'default_view_label' => 'Standardansicht', 'default_value_label' => 'Standardwert', diff --git a/resources/lang/de_AT/update.php b/resources/lang/de_AT/update.php new file mode 100644 index 00000000..ed2ddace --- /dev/null +++ b/resources/lang/de_AT/update.php @@ -0,0 +1,20 @@ + 'Update|Updates', + 'list' => [ + 'headers' => [ + 'message' => 'Nachricht', + 'status' => 'Status', + 'user' => 'Benutzer', + 'created_at' => 'Erstellt am', + 'updated_at' => 'Aktualisiert am', + ], + ], + 'form' => [ + 'message_label' => 'Nachricht', + 'user_label' => 'Benutzer', + 'user_helper' => 'Benutzer, welcher den Vorfall gemeldet hat.', + 'status_label' => 'Status', + ], +]; diff --git a/resources/lang/de_CH/metric.php b/resources/lang/de_CH/metric.php index 5474e415..1897ac7e 100644 --- a/resources/lang/de_CH/metric.php +++ b/resources/lang/de_CH/metric.php @@ -26,6 +26,7 @@ 'form' => [ 'name_label' => 'Name', 'suffix_label' => 'Suffix', + 'suffix_placeholder' => 'z. B. ms, %, usw.', 'description_label' => 'Beschreibung', 'default_view_label' => 'Standardansicht', 'default_value_label' => 'Standardwert', diff --git a/resources/lang/de_CH/update.php b/resources/lang/de_CH/update.php new file mode 100644 index 00000000..ed2ddace --- /dev/null +++ b/resources/lang/de_CH/update.php @@ -0,0 +1,20 @@ + 'Update|Updates', + 'list' => [ + 'headers' => [ + 'message' => 'Nachricht', + 'status' => 'Status', + 'user' => 'Benutzer', + 'created_at' => 'Erstellt am', + 'updated_at' => 'Aktualisiert am', + ], + ], + 'form' => [ + 'message_label' => 'Nachricht', + 'user_label' => 'Benutzer', + 'user_helper' => 'Benutzer, welcher den Vorfall gemeldet hat.', + 'status_label' => 'Status', + ], +]; diff --git a/resources/lang/en/metric.php b/resources/lang/en/metric.php index 14851444..7f2ec89b 100644 --- a/resources/lang/en/metric.php +++ b/resources/lang/en/metric.php @@ -26,6 +26,7 @@ 'form' => [ 'name_label' => 'Name', 'suffix_label' => 'Suffix', + 'suffix_placeholder' => 'e.g. ms, %, etc.', 'description_label' => 'Description', 'default_view_label' => 'Default view', 'default_value_label' => 'Default value', diff --git a/resources/lang/en/update.php b/resources/lang/en/update.php new file mode 100644 index 00000000..3465a24a --- /dev/null +++ b/resources/lang/en/update.php @@ -0,0 +1,20 @@ + 'Update|Updates', + 'list' => [ + 'headers' => [ + 'message' => 'Message', + 'status' => 'Status', + 'user' => 'User', + 'created_at' => 'Created at', + 'updated_at' => 'Updated at', + ], + ], + 'form' => [ + 'message_label' => 'Message', + 'user_label' => 'User', + 'user_helper' => 'The user who reported the incident.', + 'status_label' => 'Status', + ], +]; diff --git a/resources/views/components/incident.blade.php b/resources/views/components/incident.blade.php index 9c30e36a..0445e21a 100644 --- a/resources/views/components/incident.blade.php +++ b/resources/views/components/incident.blade.php @@ -82,9 +82,9 @@ class="text-zinc-400 transition hover:text-zinc-700 dark:text-zinc-500 dark:hove @php($reportStatus = $incident->updates->isEmpty() ? $incident->status : null) @if ($headingLevel === 1) -

{{ $reportStatus?->getLabel() ?? __('Reported') }}

+

{{ $reportStatus?->getLabel() ?? __('cachet::incident.status.reported') }}

@else -

{{ $reportStatus?->getLabel() ?? __('Reported') }}

+

{{ $reportStatus?->getLabel() ?? __('cachet::incident.status.reported') }}

@endif diff --git a/src/Filament/Resources/Components/RelationManagers/ComponentsRelationManager.php b/src/Filament/Resources/Components/RelationManagers/ComponentsRelationManager.php index 6288dc57..9631b428 100644 --- a/src/Filament/Resources/Components/RelationManagers/ComponentsRelationManager.php +++ b/src/Filament/Resources/Components/RelationManagers/ComponentsRelationManager.php @@ -29,7 +29,7 @@ class ComponentsRelationManager extends RelationManager public static function getTitle(Model $ownerRecord, string $pageClass): string { - return __('Components'); + return trans_choice('cachet::component.resource_label', 2); } public function form(Schema $schema): Schema diff --git a/src/Filament/Resources/Incidents/IncidentResource.php b/src/Filament/Resources/Incidents/IncidentResource.php index 0f07716a..7c8aa094 100644 --- a/src/Filament/Resources/Incidents/IncidentResource.php +++ b/src/Filament/Resources/Incidents/IncidentResource.php @@ -124,7 +124,7 @@ public static function form(Schema $schema): Schema ->default(ResourceVisibilityEnum::guest) ->required(), Select::make('user_id') - ->label(__('User')) + ->label(__('cachet::incident.form.user_label')) ->helperText(__('cachet::incident.form.user_helper')) ->relationship('user', 'name') ->default(auth()->id()) diff --git a/src/Filament/Resources/Metrics/MetricResource.php b/src/Filament/Resources/Metrics/MetricResource.php index 2aefb69b..b816bd1b 100644 --- a/src/Filament/Resources/Metrics/MetricResource.php +++ b/src/Filament/Resources/Metrics/MetricResource.php @@ -46,7 +46,7 @@ public static function form(Schema $schema): Schema ->label(__('cachet::metric.form.suffix_label')) ->required() ->maxLength(255) - ->placeholder('e.g. ms, %, etc.'), + ->placeholder(__('cachet::metric.form.suffix_placeholder')), MarkdownEditor::make('description') ->label(__('cachet::metric.form.description_label')) ->maxLength(255) diff --git a/src/Filament/Resources/Updates/RelationManagers/UpdatesRelationManager.php b/src/Filament/Resources/Updates/RelationManagers/UpdatesRelationManager.php index 70ea8154..631f13e1 100644 --- a/src/Filament/Resources/Updates/RelationManagers/UpdatesRelationManager.php +++ b/src/Filament/Resources/Updates/RelationManagers/UpdatesRelationManager.php @@ -27,36 +27,36 @@ public function form(Schema $schema): Schema return $schema ->components([ MarkdownEditor::make('message') - ->label(__('Message')) + ->label(__('cachet::update.form.message_label')) ->required() ->minHeight('200px') ->maxHeight('300px') ->columnSpanFull(), Select::make('user_id') - ->label(__('User')) - ->hint(__('The user who reported the incident.')) + ->label(__('cachet::update.form.user_label')) + ->hint(__('cachet::update.form.user_helper')) ->relationship('user', 'name') ->searchable() ->preload() ->createOptionForm([ TextInput::make('name') - ->label(__('Name')) + ->label(__('cachet::user.form.name_label')) ->required() ->maxLength(255), TextInput::make('email') - ->label(__('Email')) + ->label(__('cachet::user.form.email_label')) ->required() ->email() ->maxLength(255), TextInput::make('password') - ->label(__('Password')) + ->label(__('cachet::user.form.password_label')) ->required() ->password() ->confirmed() ->minLength(8), ]), ToggleButtons::make('status') - ->label(__('Status')) + ->label(__('cachet::update.form.status_label')) ->inline() ->columnSpanFull() ->options(IncidentStatusEnum::class) @@ -69,28 +69,28 @@ public function table(Table $table): Table { return $table ->recordTitleAttribute('message') - ->modelLabel(__('Update')) - ->pluralModelLabel(__('Updates')) + ->modelLabel(trans_choice('cachet::update.resource_label', 1)) + ->pluralModelLabel(trans_choice('cachet::update.resource_label', 2)) ->columns([ TextColumn::make('message') - ->label(__('Message')) + ->label(__('cachet::update.list.headers.message')) ->searchable() ->limit(80) ->wrap(), TextColumn::make('status') - ->label(__('Status')) + ->label(__('cachet::update.list.headers.status')) ->badge() ->sortable() ->visible(fn (): bool => $this->getOwnerRecord() instanceof Incident), TextColumn::make('user.name') - ->label(__('User')) + ->label(__('cachet::update.list.headers.user')) ->sortable(), TextColumn::make('created_at') - ->label(__('Created at')) + ->label(__('cachet::update.list.headers.created_at')) ->dateTime() ->sortable(), TextColumn::make('updated_at') - ->label(__('Updated at')) + ->label(__('cachet::update.list.headers.updated_at')) ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), @@ -98,7 +98,7 @@ public function table(Table $table): Table ->defaultSort('created_at', 'desc') ->filters([ SelectFilter::make('status') - ->label(__('Status')) + ->label(__('cachet::update.list.headers.status')) ->options(IncidentStatusEnum::class) ->visible(fn (): bool => $this->getOwnerRecord() instanceof Incident), ]) diff --git a/tests/Feature/Filament/Resources/IncidentResourceTest.php b/tests/Feature/Filament/Resources/IncidentResourceTest.php index 5cc2b2f1..f35c2905 100644 --- a/tests/Feature/Filament/Resources/IncidentResourceTest.php +++ b/tests/Feature/Filament/Resources/IncidentResourceTest.php @@ -6,6 +6,7 @@ use Cachet\Enums\IncidentStatusEnum; use Cachet\Enums\ResourceVisibilityEnum; use Cachet\Filament\Components\ComponentOptions; +use Cachet\Filament\Resources\Components\RelationManagers\ComponentsRelationManager; use Cachet\Filament\Resources\Incidents\IncidentResource; use Cachet\Filament\Resources\Incidents\Pages\CreateIncident; use Cachet\Filament\Resources\Incidents\Pages\EditIncident; @@ -18,6 +19,7 @@ use Cachet\Notifications\NewIncidentNotification; use Cachet\Settings\MailSettings; use Filament\Facades\Filament; +use Filament\Tables\Columns\TextColumn; use Illuminate\Support\Facades\Notification; use Workbench\App\User; @@ -185,6 +187,20 @@ ->assertTableColumnStateSet('message', $update->message, $update); }); +it('translates the update and component relation managers', function () { + app()->setLocale('de'); + $incident = Incident::factory()->create(); + + livewire(UpdatesRelationManager::class, [ + 'ownerRecord' => $incident, + 'pageClass' => EditIncident::class, + ]) + ->assertTableColumnExists('message', fn (TextColumn $column): bool => $column->getLabel() === 'Nachricht') + ->assertTableColumnExists('created_at', fn (TextColumn $column): bool => $column->getLabel() === 'Erstellt am'); + + expect(ComponentsRelationManager::getTitle($incident, EditIncident::class))->toBe('Komponenten'); +}); + it('excludes already attached components from the attach action options', function () { $incident = Incident::factory()->create(); $attached = Component::factory()->create(['name' => 'Already Attached']); diff --git a/tests/Feature/StatusPage/StatusPageTest.php b/tests/Feature/StatusPage/StatusPageTest.php index e812b472..0e5d03d3 100644 --- a/tests/Feature/StatusPage/StatusPageTest.php +++ b/tests/Feature/StatusPage/StatusPageTest.php @@ -562,6 +562,23 @@ function systemStatusGroupPattern(ComponentGroup $group, bool $open): string ->assertDontSee('Affected Components'); }); +it('translates the reported label of incidents with updates', function () { + $settings = app(AppSettings::class); + $settings->locale = 'de'; + $settings->save(); + + $incident = Incident::factory()->create(['status' => IncidentStatusEnum::investigating]); + $incident->updates()->create([ + 'message' => 'We have identified the issue.', + 'status' => IncidentStatusEnum::identified, + ]); + + $this->get(route('cachet.status-page')) + ->assertOk() + ->assertSee('Gemeldet') + ->assertDontSee('Reported'); +}); + it('does not error when the from query parameter is malformed', function () { $this->get(route('cachet.status-page', ['from' => '2024-04-15/'])) ->assertOk(); From 54e26233c973b33fc45db7874c4504897204a8fd Mon Sep 17 00:00:00 2001 From: jnk0 <3634281+jnk0@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:43:16 +0100 Subject: [PATCH 3/3] Retrigger CI