From 1f471cc1ea6708a5faf85d2f61ee51f07779fab6 Mon Sep 17 00:00:00 2001 From: Vasyka Date: Sun, 26 Jul 2026 10:43:54 +0000 Subject: [PATCH] i18n(dates): use app locale for month names on MechanicKpi + PDF appointments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MechanicKpi getPeriodLabel() was hardcoded to ->locale('ro') which forced Romanian month names ('iulie 2026') regardless of the app locale. Same on PDF appointments day-label. Both now switch to app()->getLocale() so RU shows «июль 2026», EN 'July 2026'. SetLocale middleware already calls Carbon::setLocale on every request, so translatedFormat() elsewhere already respects the app locale — no other files needed patching. Co-Authored-By: Claude Opus 4.7 (1M context) --- app/Filament/Tenant/Pages/MechanicKpi.php | 2 +- resources/views/pdf/appointments.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Filament/Tenant/Pages/MechanicKpi.php b/app/Filament/Tenant/Pages/MechanicKpi.php index be602f9..951bfa7 100644 --- a/app/Filament/Tenant/Pages/MechanicKpi.php +++ b/app/Filament/Tenant/Pages/MechanicKpi.php @@ -93,6 +93,6 @@ class MechanicKpi extends Page public function getPeriodLabel(): string { - return Carbon::parse($this->period . '-01')->locale('ro')->isoFormat('MMMM YYYY'); + return Carbon::parse($this->period . '-01')->locale(app()->getLocale())->isoFormat('MMMM YYYY'); } } diff --git a/resources/views/pdf/appointments.blade.php b/resources/views/pdf/appointments.blade.php index 9afd940..6e2b30b 100644 --- a/resources/views/pdf/appointments.blade.php +++ b/resources/views/pdf/appointments.blade.php @@ -24,7 +24,7 @@
Generat la {{ $generatedAt }} · {{ $appointments->flatten()->count() }} programări total
@forelse ($appointments as $date => $dayAppts) - @php $dateLabel = \Carbon\Carbon::parse($date)->locale('ro')->isoFormat('dddd, D MMMM YYYY'); @endphp + @php $dateLabel = \Carbon\Carbon::parse($date)->locale(app()->getLocale())->isoFormat('dddd, D MMMM YYYY'); @endphp

{{ ucfirst($dateLabel) }} · {{ $dayAppts->count() }} programări