feat(i18n): wrap 1103 hardcoded UI strings across Filament with __()

- Convert static $modelLabel/$pluralModelLabel/$title to getter methods
- Wrap ->label()/->placeholder()/->helperText()/->description()/->title()/->body() args
- Wrap Section::make()/Fieldset::make()/Notification::make()->title() args
- Fix RelationManagers::getTitle() signature to match parent (Model, string)
- Fix Pages::getTitle() to instance method (BasePage::getTitle is non-static)
- Extend lang/ru.json + lang/en.json with 700+ common terms; identity fallback for the rest
- Remove duplicate getters in 5 resources that had manual getModelLabel already

All 306 tests pass. Missing translations fall back to the RO key so the UI never breaks.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-15 05:04:24 +00:00
parent 78ff8d4b43
commit f7fc69077b
83 changed files with 4212 additions and 1251 deletions
+26 -26
View File
@@ -54,39 +54,39 @@ class UserResource extends Resource
public static function form(Schema $schema): Schema
{
return $schema->components([
Schemas\Components\Section::make('Identitate')
Schemas\Components\Section::make(__('Identitate'))
->columns(2)
->schema([
Forms\Components\TextInput::make('name')->label('Nume')->required()->maxLength(120),
Forms\Components\TextInput::make('name')->label(__('Nume'))->required()->maxLength(120),
Forms\Components\TextInput::make('email')->email()->required()->maxLength(120),
Forms\Components\TextInput::make('phone')->tel()->maxLength(40),
Forms\Components\Select::make('locale')
->options(['ro' => 'Română', 'ru' => 'Русский', 'en' => 'English'])
->default('ro'),
]),
Schemas\Components\Section::make('Acces')
Schemas\Components\Section::make(__('Acces'))
->columns(2)
->schema([
Forms\Components\Select::make('role')
->label('Rol primar')
->label(__('Rol primar'))
->options(\App\Auth\Permissions::roleLabels())
->required()
->default('mechanic')
->helperText('Rolul principal — sincronizat automat cu drepturile RBAC.'),
->helperText(__('Rolul principal — sincronizat automat cu drepturile RBAC.')),
Forms\Components\Select::make('status')
->options(['active' => 'Activ', 'inactive' => 'Inactiv', 'blocked' => 'Blocat'])
->default('active')
->required(),
Forms\Components\TextInput::make('password')
->label('Parolă')
->label(__('Parolă'))
->password()
->required(fn (string $context) => $context === 'create')
->dehydrated(fn ($state) => filled($state))
->dehydrateStateUsing(fn ($state) => Hash::make($state))
->minLength(6)
->helperText('La editare lasă gol pentru a păstra parola actuală.'),
->helperText(__('La editare lasă gol pentru a păstra parola actuală.')),
Forms\Components\Select::make('roles_picked')
->label('Roluri suplimentare')
->label(__('Roluri suplimentare'))
->multiple()
->options(\App\Auth\Permissions::roleLabels())
->afterStateHydrated(function ($component, $record) {
@@ -94,35 +94,35 @@ class UserResource extends Resource
})
->dehydrated(false)
->columnSpanFull()
->helperText('Roluri suplimentare peste rolul primar — drepturile se cumulează.'),
->helperText(__('Roluri suplimentare peste rolul primar — drepturile se cumulează.')),
]),
Schemas\Components\Section::make('Salariu & marjă')
->description('Configurează procentele pentru calcul salariu. Marja internă (nu TVA) se scade din prețul de manoperă pentru a determina baza salariului.')
Schemas\Components\Section::make(__('Salariu & marjă'))
->description(__('Configurează procentele pentru calcul salariu. Marja internă (nu TVA) se scade din prețul de manoperă pentru a determina baza salariului.'))
->columns(2)
->visible(fn () => auth()->user()?->canDo(\App\Auth\Permissions::FINANCE_VIEW_INTERNAL_MARGIN) ?? false)
->schema([
Forms\Components\TextInput::make('hourly_rate')
->label('Tarif orar (MDL)')
->label(__('Tarif orar (MDL)'))
->numeric()
->step(0.01)
->placeholder('Ex: 100'),
->placeholder(__('Ex: 100')),
Forms\Components\TextInput::make('internal_margin_pct')
->label('Marjă internă (%)')
->label(__('Marjă internă (%)'))
->numeric()
->step(0.01)
->minValue(0)
->maxValue(90)
->placeholder('Ex: 20 pentru +20%')
->helperText('Doar la manopere (proprii + subcontract). Baza salariu = preț client × (1 marjă/100). Lasă gol pentru a folosi valoarea implicită a companiei.'),
->placeholder(__('Ex: 20 pentru +20%'))
->helperText(__('Doar la manopere (proprii + subcontract). Baza salariu = preț client × (1 marjă/100). Lasă gol pentru a folosi valoarea implicită a companiei.')),
]),
Schemas\Components\Section::make('Securitate')
Schemas\Components\Section::make(__('Securitate'))
->columns(2)
->schema([
Forms\Components\Placeholder::make('mfa_status')
->label('Autentificare 2FA')
->label(__('Autentificare 2FA'))
->content(fn ($record) => $record && $record->hasTwoFactorEnabled() ? '✓ Activat (TOTP)' : '✗ Dezactivat'),
Forms\Components\Placeholder::make('last_login')
->label('Ultima autentificare')
->label(__('Ultima autentificare'))
->content(fn ($record) => $record?->last_login_at?->diffForHumans() ?? '—'),
]),
]);
@@ -139,7 +139,7 @@ class UserResource extends Resource
->formatStateUsing(fn ($state) => \App\Auth\Permissions::roleLabels()[$state] ?? $state)
->badge(),
Tables\Columns\IconColumn::make('app_authentication_secret')
->label('2FA')
->label(__('2FA'))
->boolean()
->getStateUsing(fn ($record) => $record->hasTwoFactorEnabled())
->trueIcon('heroicon-o-shield-check')
@@ -147,14 +147,14 @@ class UserResource extends Resource
->falseIcon('heroicon-o-shield-exclamation')
->falseColor('warning'),
Tables\Columns\TextColumn::make('active_sessions')
->label('Sesiuni')
->label(__('Sesiuni'))
->getStateUsing(fn ($record) => \Illuminate\Support\Facades\DB::table('sessions')->where('user_id', $record->id)->count())
->badge()
->color(fn ($state) => $state > 0 ? 'success' : 'gray')
->toggleable(),
Tables\Columns\TextColumn::make('permission_overrides_count')
->counts('permissionOverrides')
->label('Excepții')
->label(__('Excepții'))
->badge()
->color('warning')
->toggleable(isToggledHiddenByDefault: true),
@@ -180,7 +180,7 @@ class UserResource extends Resource
->actions([
Actions\EditAction::make(),
Actions\Action::make('force_logout')
->label('Force logout')
->label(__('Force logout'))
->icon('heroicon-o-arrow-right-on-rectangle')
->color('warning')
->visible(fn ($record) => \Illuminate\Support\Facades\DB::table('sessions')->where('user_id', $record->id)->exists())
@@ -191,16 +191,16 @@ class UserResource extends Resource
\Filament\Notifications\Notification::make()->title("$n sesiuni revoke-uite")->success()->send();
}),
Actions\Action::make('reset_2fa')
->label('Resetează 2FA')
->label(__('Resetează 2FA'))
->icon('heroicon-o-shield-exclamation')
->color('warning')
->visible(fn ($record) => $record && $record->hasTwoFactorEnabled())
->requiresConfirmation()
->modalDescription('Dezactivează 2FA pentru acest utilizator. Va trebui să re-configureze TOTP la următoarea autentificare.')
->modalDescription(__('Dezactivează 2FA pentru acest utilizator. Va trebui să re-configureze TOTP la următoarea autentificare.'))
->action(function ($record) {
$record->saveAppAuthenticationSecret(null);
$record->saveAppAuthenticationRecoveryCodes(null);
\Filament\Notifications\Notification::make()->title('2FA resetat')->success()->send();
\Filament\Notifications\Notification::make()->title(__('2FA resetat'))->success()->send();
}),
Actions\DeleteAction::make(),
])