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:
@@ -28,7 +28,12 @@ class SubscriptionResource extends Resource
|
||||
return __('nav.label.Facturi & abonamente');
|
||||
}
|
||||
|
||||
protected static ?string $modelLabel = 'factură';
|
||||
protected static ?string $modelLabel = null;
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('factură');
|
||||
}
|
||||
|
||||
protected static ?string $pluralModelLabel = 'facturi';
|
||||
|
||||
@@ -45,15 +50,15 @@ class SubscriptionResource extends Resource
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Schemas\Components\Section::make('Companie & plan')
|
||||
Schemas\Components\Section::make(__('Companie & plan'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Select::make('company_id')
|
||||
->label('Companie')
|
||||
->label(__('Companie'))
|
||||
->options(fn () => Company::orderBy('name')->pluck('name', 'id'))
|
||||
->required()->searchable()->live(),
|
||||
Forms\Components\Select::make('plan_id')
|
||||
->label('Plan')
|
||||
->label(__('Plan'))
|
||||
->options(fn () => Plan::pluck('name', 'id'))
|
||||
->required()->searchable()->live()
|
||||
->afterStateUpdated(function ($state, Set $set, Get $get) {
|
||||
@@ -80,7 +85,7 @@ class SubscriptionResource extends Resource
|
||||
Forms\Components\Select::make('status')
|
||||
->options(Subscription::STATUSES)->default('pending')->required(),
|
||||
]),
|
||||
Schemas\Components\Section::make('Sumă')
|
||||
Schemas\Components\Section::make(__('Sumă'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('amount')->numeric()->required()->suffix(fn (Get $get) => $get('currency') ?? 'MDL'),
|
||||
@@ -88,19 +93,19 @@ class SubscriptionResource extends Resource
|
||||
Forms\Components\Select::make('payment_method')
|
||||
->options(Subscription::PAYMENT_METHODS),
|
||||
]),
|
||||
Schemas\Components\Section::make('Perioadă')
|
||||
Schemas\Components\Section::make(__('Perioadă'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\DatePicker::make('period_start')->required()->default(today()),
|
||||
Forms\Components\DatePicker::make('period_end')->required(),
|
||||
Forms\Components\DateTimePicker::make('due_at')->label('Scadent la'),
|
||||
Forms\Components\DateTimePicker::make('paid_at')->label('Plătit la'),
|
||||
Forms\Components\DateTimePicker::make('due_at')->label(__('Scadent la')),
|
||||
Forms\Components\DateTimePicker::make('paid_at')->label(__('Plătit la')),
|
||||
]),
|
||||
Schemas\Components\Section::make('Detalii')
|
||||
Schemas\Components\Section::make(__('Detalii'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('invoice_number')->label('Nr. factură')->placeholder('auto-generat')->maxLength(30),
|
||||
Forms\Components\TextInput::make('reference')->label('Referință (Stripe id, transfer)')->maxLength(100),
|
||||
Forms\Components\TextInput::make('invoice_number')->label(__('Nr. factură'))->placeholder('auto-generat')->maxLength(30),
|
||||
Forms\Components\TextInput::make('reference')->label(__('Referință (Stripe id, transfer)'))->maxLength(100),
|
||||
Forms\Components\Textarea::make('notes')->columnSpanFull()->rows(2),
|
||||
]),
|
||||
]);
|
||||
@@ -111,15 +116,15 @@ class SubscriptionResource extends Resource
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('invoice_number')
|
||||
->label('Factură')
|
||||
->label(__('Factură'))
|
||||
->placeholder(fn ($record) => '—')
|
||||
->copyable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('company.name')
|
||||
->label('Companie')
|
||||
->label(__('Companie'))
|
||||
->searchable()
|
||||
->url(fn ($record) => \App\Filament\Central\Resources\CompanyResource::getUrl('view', ['record' => $record->company_id])),
|
||||
Tables\Columns\TextColumn::make('plan.name')->label('Plan')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('plan.name')->label(__('Plan'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('period')
|
||||
->formatStateUsing(fn ($s) => Subscription::PERIODS[$s] ?? $s)
|
||||
->badge(),
|
||||
@@ -137,8 +142,8 @@ class SubscriptionResource extends Resource
|
||||
'cancelled', 'refunded' => 'gray',
|
||||
default => 'primary',
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('period_end')->label('Până la')->date(),
|
||||
Tables\Columns\TextColumn::make('paid_at')->label('Plătit')->date()->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('period_end')->label(__('Până la'))->date(),
|
||||
Tables\Columns\TextColumn::make('paid_at')->label(__('Plătit'))->date()->placeholder('—'),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('status')->options(Subscription::STATUSES),
|
||||
@@ -146,7 +151,7 @@ class SubscriptionResource extends Resource
|
||||
])
|
||||
->actions([
|
||||
Actions\Action::make('mark_paid')
|
||||
->label('Marchează plătit')
|
||||
->label(__('Marchează plătit'))
|
||||
->icon('heroicon-m-check-circle')
|
||||
->color('success')
|
||||
->visible(fn ($record) => $record->status !== 'paid')
|
||||
@@ -163,8 +168,8 @@ class SubscriptionResource extends Resource
|
||||
Actions\EditAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
])
|
||||
->emptyStateHeading('Nicio factură generată')
|
||||
->emptyStateDescription('Crează manual prima factură sau folosește butonul „Generează factură" din pagina Companiei.')
|
||||
->emptyStateHeading(__('Nicio factură generată'))
|
||||
->emptyStateDescription(__('Crează manual prima factură sau folosește butonul „Generează factură" din pagina Companiei.'))
|
||||
->defaultSort('created_at', 'desc');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user