i18n(users): wrap role Select options with I18n::opts + 2FA status + Locale

- Both role selects (primary + additional roles multi) passed the raw
  roleLabels() array without translation; wrap with I18n::opts() so
  Proprietar/Administrator/… now render translated in RU/EN.
- 2FA status text ('✓ Activat (TOTP)' / '✗ Dezactivat') split so
  the checkmark stays and label runs through __().
- +3 translations (Activat (TOTP), Dezactivat, Locale) — Locale is
  Filament's auto-generated headline from the `locale` field.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-18 11:04:30 +00:00
parent 00afca8a17
commit 58f168dd97
3 changed files with 9 additions and 3 deletions
@@ -79,7 +79,7 @@ class UserResource extends Resource
->schema([
Forms\Components\Select::make('role')
->label(__('Rol primar'))
->options(\App\Auth\Permissions::roleLabels())
->options(\App\Support\I18n::opts(\App\Auth\Permissions::roleLabels()))
->required()
->default('mechanic')
->helperText(__('Rolul principal — sincronizat automat cu drepturile RBAC.')),
@@ -98,7 +98,7 @@ class UserResource extends Resource
Forms\Components\Select::make('roles_picked')
->label(__('Roluri suplimentare'))
->multiple()
->options(\App\Auth\Permissions::roleLabels())
->options(\App\Support\I18n::opts(\App\Auth\Permissions::roleLabels()))
->afterStateHydrated(function ($component, $record) {
if ($record) $component->state($record->roles->pluck('name')->all());
})
@@ -130,7 +130,7 @@ class UserResource extends Resource
->schema([
Forms\Components\Placeholder::make('mfa_status')
->label(__('Autentificare 2FA'))
->content(fn ($record) => $record && $record->hasTwoFactorEnabled() ? '✓ Activat (TOTP)' : '✗ Dezactivat'),
->content(fn ($record) => $record && $record->hasTwoFactorEnabled() ? '✓ ' . __('Activat (TOTP)') : '✗ ' . __('Dezactivat')),
Forms\Components\Placeholder::make('last_login')
->label(__('Ultima autentificare'))
->content(fn ($record) => $record?->last_login_at?->diffForHumans() ?? '—'),