i18n: wrap all formatStateUsing(fn(\$s)=>X::CONST[\$s]??\$s) with __() (21 files)

Previous sed pass only matched \$state; missed \$s and other arg-name
variants. This time the regex is arg-name-agnostic and touches 21
files across Filament resources & relation managers.

Also wraps two special cases: UserResource role-labels lookup and
LaborResource pricing_mode ternary ('Fix' | 'Pe oră').

+27 human translations for the enum values that were still identity
fallback: WorkOrderWork.STATUSES (De făcut), Purchase.STATUSES,
OnlineOrder.STATUSES, Call.DIRECTIONS/STATUSES, BodyshopJob.TYPES/
STATUSES, TireSet.SEASONS, MessageTemplate.CHANNELS,
DamagePoint.SEVERITIES, ServiceTemplateItem.KINDS.

All 306 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-16 07:41:35 +00:00
parent e4e63a3a09
commit e969bb9c7d
25 changed files with 78 additions and 40 deletions
@@ -77,7 +77,7 @@ class PartsRelationManager extends RelationManager
Tables\Columns\TextColumn::make('sell_price')->label(__('Preț'))->money('MDL')->alignRight(),
Tables\Columns\TextColumn::make('total')->money('MDL')->alignRight(),
Tables\Columns\TextColumn::make('status')
->formatStateUsing(fn ($s) => WorkOrderPart::STATUSES[$s] ?? $s)
->formatStateUsing(fn ($s) => __(WorkOrderPart::STATUSES[$s] ?? $s))
->badge()
->colors([
'gray' => ['needed'],
@@ -44,7 +44,7 @@ class PaymentsRelationManager extends RelationManager
Tables\Columns\TextColumn::make('amount')->money('MDL')->alignRight()
->summarize(Tables\Columns\Summarizers\Sum::make()->money('MDL')->label(__('Plătit'))),
Tables\Columns\TextColumn::make('method')
->formatStateUsing(fn ($s) => Payment::METHODS[$s] ?? $s)
->formatStateUsing(fn ($s) => __(Payment::METHODS[$s] ?? $s))
->badge(),
Tables\Columns\TextColumn::make('reference')->placeholder('—'),
])
@@ -60,7 +60,7 @@ class SubcontractJobsRelationManager extends RelationManager
->money('MDL')->alignRight()
->color(fn ($s) => (float) $s > 0 ? 'success' : ((float) $s < 0 ? 'danger' : 'gray')),
Tables\Columns\TextColumn::make('status')
->formatStateUsing(fn ($s) => SubcontractJob::STATUSES[$s] ?? $s)
->formatStateUsing(fn ($s) => __(SubcontractJob::STATUSES[$s] ?? $s))
->badge()
->colors(['warning' => ['sent', 'in_progress'], 'success' => ['done', 'returned'], 'danger' => ['cancelled']]),
])
@@ -89,7 +89,7 @@ class WorksRelationManager extends RelationManager
}),
Tables\Columns\TextColumn::make('master.name')->label(__('Maistru'))->placeholder('—'),
Tables\Columns\TextColumn::make('status')
->formatStateUsing(fn ($s) => WorkOrderWork::STATUSES[$s] ?? $s)
->formatStateUsing(fn ($s) => __(WorkOrderWork::STATUSES[$s] ?? $s))
->badge()
->colors(['gray' => ['todo'], 'warning' => ['in_progress'], 'success' => ['done']]),
])