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,41 +31,46 @@ class EmployeeProfileResource extends Resource
|
||||
|
||||
protected static ?string $modelLabel = 'angajat';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'angajați';
|
||||
protected static ?string $pluralModelLabel = null;
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('angajați');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 52;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Schemas\Components\Section::make('Profil')
|
||||
Schemas\Components\Section::make(__('Profil'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Select::make('user_id')
|
||||
->label('Utilizator')
|
||||
->label(__('Utilizator'))
|
||||
->options(fn () => User::orderBy('name')->pluck('name', 'id'))
|
||||
->searchable()
|
||||
->required()
|
||||
->unique(ignoreRecord: true),
|
||||
Forms\Components\TextInput::make('position')->label('Funcție')->maxLength(120),
|
||||
Forms\Components\DatePicker::make('hire_date')->label('Angajat din'),
|
||||
Forms\Components\TextInput::make('position')->label(__('Funcție'))->maxLength(120),
|
||||
Forms\Components\DatePicker::make('hire_date')->label(__('Angajat din')),
|
||||
]),
|
||||
Schemas\Components\Section::make('Salariu & comisioane')
|
||||
Schemas\Components\Section::make(__('Salariu & comisioane'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('base_salary')->label('Salariu bază')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('base_salary')->label(__('Salariu bază'))->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('works_pct')
|
||||
->label('% manopere')
|
||||
->label(__('% manopere'))
|
||||
->numeric()->default(0)
|
||||
->suffix('%')
|
||||
->helperText('% din venitul manoperelor finalizate.'),
|
||||
->helperText(__('% din venitul manoperelor finalizate.')),
|
||||
Forms\Components\TextInput::make('parts_pct')
|
||||
->label('% marja piese')
|
||||
->label(__('% marja piese'))
|
||||
->numeric()->default(0)
|
||||
->suffix('%')
|
||||
->helperText('% din marja (sell-buy) pieselor montate.'),
|
||||
->helperText(__('% din marja (sell-buy) pieselor montate.')),
|
||||
]),
|
||||
Forms\Components\Textarea::make('notes')->label('Notițe')->columnSpanFull()->rows(2),
|
||||
Forms\Components\Textarea::make('notes')->label(__('Notițe'))->columnSpanFull()->rows(2),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -73,12 +78,12 @@ class EmployeeProfileResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('user.name')->label('Nume')->searchable()->sortable(),
|
||||
Tables\Columns\TextColumn::make('position')->label('Funcție')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('user.name')->label(__('Nume'))->searchable()->sortable(),
|
||||
Tables\Columns\TextColumn::make('position')->label(__('Funcție'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('base_salary')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('works_pct')->label('% Manopere')
|
||||
Tables\Columns\TextColumn::make('works_pct')->label(__('% Manopere'))
|
||||
->formatStateUsing(fn ($s) => $s . '%')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('parts_pct')->label('% Piese')
|
||||
Tables\Columns\TextColumn::make('parts_pct')->label(__('% Piese'))
|
||||
->formatStateUsing(fn ($s) => $s . '%')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('hire_date')->date('d.m.Y')->placeholder('—'),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user