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:
@@ -31,7 +31,12 @@ class PayrollAdjustmentResource extends Resource
|
||||
|
||||
protected static ?string $modelLabel = 'ajustare';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'bonusuri/avansuri';
|
||||
protected static ?string $pluralModelLabel = null;
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('bonusuri/avansuri');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 54;
|
||||
|
||||
@@ -48,11 +53,11 @@ class PayrollAdjustmentResource extends Resource
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Schemas\Components\Section::make('Detalii')
|
||||
Schemas\Components\Section::make(__('Detalii'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Select::make('user_id')
|
||||
->label('Utilizator')
|
||||
->label(__('Utilizator'))
|
||||
->options(fn () => User::orderBy('name')->pluck('name', 'id'))
|
||||
->searchable()
|
||||
->required(),
|
||||
@@ -60,14 +65,14 @@ class PayrollAdjustmentResource extends Resource
|
||||
->options(PayrollAdjustment::TYPES)
|
||||
->default('bonus')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('amount')->label('Sumă')->numeric()->required(),
|
||||
Forms\Components\TextInput::make('amount')->label(__('Sumă'))->numeric()->required(),
|
||||
Forms\Components\TextInput::make('period')
|
||||
->label('Perioadă (YYYY-MM)')
|
||||
->label(__('Perioadă (YYYY-MM)'))
|
||||
->placeholder(now()->format('Y-m'))
|
||||
->regex('/^\d{4}-\d{2}$/')
|
||||
->required(),
|
||||
Forms\Components\DatePicker::make('date')->default(today())->required(),
|
||||
Forms\Components\TextInput::make('reason')->label('Motiv')->maxLength(160),
|
||||
Forms\Components\TextInput::make('reason')->label(__('Motiv'))->maxLength(160),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -77,7 +82,7 @@ class PayrollAdjustmentResource extends Resource
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('date')->date('d.m.Y')->sortable(),
|
||||
Tables\Columns\TextColumn::make('user.name')->label('Utilizator')->searchable(),
|
||||
Tables\Columns\TextColumn::make('user.name')->label(__('Utilizator'))->searchable(),
|
||||
Tables\Columns\TextColumn::make('type')
|
||||
->formatStateUsing(fn ($s) => PayrollAdjustment::TYPES[$s] ?? $s)
|
||||
->badge()
|
||||
@@ -89,12 +94,12 @@ class PayrollAdjustmentResource extends Resource
|
||||
Tables\Columns\TextColumn::make('period'),
|
||||
Tables\Columns\TextColumn::make('amount')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('reason')->limit(40),
|
||||
Tables\Columns\IconColumn::make('applied')->boolean()->label('Aplicat'),
|
||||
Tables\Columns\IconColumn::make('applied')->boolean()->label(__('Aplicat')),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('type')->options(PayrollAdjustment::TYPES),
|
||||
Tables\Filters\SelectFilter::make('user_id')
|
||||
->label('Utilizator')
|
||||
->label(__('Utilizator'))
|
||||
->options(fn () => User::pluck('name', 'id')),
|
||||
])
|
||||
->actions([
|
||||
|
||||
Reference in New Issue
Block a user