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:
@@ -36,24 +36,24 @@ class SuperAdminResource extends Resource
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Schemas\Components\Section::make('Identificare')
|
||||
Schemas\Components\Section::make(__('Identificare'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->required()->maxLength(120),
|
||||
Forms\Components\TextInput::make('email')->email()->required()->unique(ignoreRecord: true)->maxLength(120),
|
||||
Forms\Components\TextInput::make('phone')->tel()->maxLength(40),
|
||||
Forms\Components\Toggle::make('is_active')->label('Activ')->default(true),
|
||||
Forms\Components\Toggle::make('is_active')->label(__('Activ'))->default(true),
|
||||
]),
|
||||
Schemas\Components\Section::make('Permisiuni')
|
||||
Schemas\Components\Section::make(__('Permisiuni'))
|
||||
->columns(1)
|
||||
->schema([
|
||||
Forms\Components\Select::make('role')
|
||||
->options(SuperAdmin::ROLES)
|
||||
->default('support')
|
||||
->required()
|
||||
->helperText('Owner = drepturi totale. Admin = aproape la fel. Sales = doar tenanți + planuri. Finance = facturi. Support = read-only.'),
|
||||
->helperText(__('Owner = drepturi totale. Admin = aproape la fel. Sales = doar tenanți + planuri. Finance = facturi. Support = read-only.')),
|
||||
]),
|
||||
Schemas\Components\Section::make('Parolă')
|
||||
Schemas\Components\Section::make(__('Parolă'))
|
||||
->columns(1)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('password')
|
||||
@@ -65,7 +65,7 @@ class SuperAdminResource extends Resource
|
||||
->minLength(8)
|
||||
->helperText(fn (string $operation) => $operation === 'edit' ? 'Lasă gol ca să o păstrezi.' : 'Min 8 caractere.'),
|
||||
]),
|
||||
Forms\Components\Textarea::make('notes')->label('Note interne')->rows(2)->columnSpanFull(),
|
||||
Forms\Components\Textarea::make('notes')->label(__('Note interne'))->rows(2)->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -92,25 +92,25 @@ class SuperAdminResource extends Resource
|
||||
'sales' => 'info',
|
||||
default => 'gray',
|
||||
}),
|
||||
Tables\Columns\IconColumn::make('is_active')->boolean()->label('Activ'),
|
||||
Tables\Columns\IconColumn::make('is_active')->boolean()->label(__('Activ')),
|
||||
Tables\Columns\IconColumn::make('app_authentication_secret')
|
||||
->label('2FA')
|
||||
->label(__('2FA'))
|
||||
->boolean()
|
||||
->getStateUsing(fn ($record) => $record?->app_authentication_secret !== null)
|
||||
->trueIcon('heroicon-o-lock-closed')
|
||||
->falseIcon('heroicon-o-lock-open')
|
||||
->trueColor('success')
|
||||
->falseColor('warning'),
|
||||
Tables\Columns\TextColumn::make('last_login_at')->label('Ultim login')->dateTime()->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('last_login_at')->label(__('Ultim login'))->dateTime()->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('created_at')->date(),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('role')->options(SuperAdmin::ROLES),
|
||||
Tables\Filters\TernaryFilter::make('is_active')->label('Activ'),
|
||||
Tables\Filters\TernaryFilter::make('is_active')->label(__('Activ')),
|
||||
])
|
||||
->actions([
|
||||
Actions\Action::make('reset_password')
|
||||
->label('Reset parolă')
|
||||
->label(__('Reset parolă'))
|
||||
->icon('heroicon-m-key')
|
||||
->color('warning')
|
||||
->schema([
|
||||
@@ -119,7 +119,7 @@ class SuperAdminResource extends Resource
|
||||
])
|
||||
->action(function (SuperAdmin $record, array $data) {
|
||||
$record->update(['password' => Hash::make($data['new_password'])]);
|
||||
Notification::make()->title('Parolă resetată.')->success()->send();
|
||||
Notification::make()->title(__('Parolă resetată.'))->success()->send();
|
||||
}),
|
||||
Actions\Action::make('toggle_2fa')
|
||||
->label(fn (SuperAdmin $record) => $record->app_authentication_secret ? 'Dezactivează 2FA' : 'Forțează re-setare 2FA')
|
||||
@@ -133,19 +133,19 @@ class SuperAdminResource extends Resource
|
||||
'app_authentication_recovery_codes' => null,
|
||||
'email_authentication_at' => null,
|
||||
])->saveQuietly();
|
||||
Notification::make()->title('2FA dezactivat.')->success()->send();
|
||||
Notification::make()->title(__('2FA dezactivat.'))->success()->send();
|
||||
}),
|
||||
Actions\EditAction::make(),
|
||||
Actions\DeleteAction::make()
|
||||
->before(function (SuperAdmin $record) {
|
||||
if (auth('central')->id() === $record->id) {
|
||||
Notification::make()->title('Nu te poți șterge pe tine!')->danger()->send();
|
||||
Notification::make()->title(__('Nu te poți șterge pe tine!'))->danger()->send();
|
||||
return false;
|
||||
}
|
||||
}),
|
||||
])
|
||||
->emptyStateHeading('Doar tu ești aici')
|
||||
->emptyStateDescription('Adaugă echipa ta — colegi de la suport, sales, finance — fiecare cu rolul lui.')
|
||||
->emptyStateHeading(__('Doar tu ești aici'))
|
||||
->emptyStateDescription(__('Adaugă echipa ta — colegi de la suport, sales, finance — fiecare cu rolul lui.'))
|
||||
->defaultSort('created_at', 'desc');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user