feat: add i18n support for Vietnamese and English
Some checks failed
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
Tests / PHP 8.5 (push) Has been cancelled

This commit is contained in:
2026-05-04 10:40:39 +00:00
parent 3a8db5cae6
commit 8c6b71cb8a
64 changed files with 4652 additions and 254 deletions

View File

@@ -23,13 +23,18 @@ class ProductResource extends Resource
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBuildingStorefront;
protected static ?string $pluralLabel = 'Products';
protected static ?string $pluralLabel = 'app.resource_products';
protected static ?int $navigationSort = 1;
public static function getPluralLabel(): ?string
{
return __('app.resource_products');
}
public static function getNavigationGroup(): ?string
{
return 'Management';
return __('app.nav_management');
}
public static function form(Schema $schema): Schema

View File

@@ -15,7 +15,7 @@ class ContractsRelationManager extends RelationManager
{
protected static string $relationship = 'contracts';
protected static ?string $title = 'Contracts';
protected static ?string $title = 'app.contracts';
public function table(Table $table): Table
{
@@ -26,7 +26,7 @@ class ContractsRelationManager extends RelationManager
->badge()
->formatStateUsing(fn (string $state): string => ContractType::from($state)->label()),
TextColumn::make('customer.name')
->label('Customer')
->label(__('app.widget_customer'))
->searchable(),
TextColumn::make('status')
->badge()
@@ -44,10 +44,10 @@ class ContractsRelationManager extends RelationManager
->date('d/m/Y')
->sortable(),
TextColumn::make('signed_status')
->label('Signed'),
->label(__('app.signed')),
TextColumn::make('feedbacks_count')
->counts('feedbacks')
->label('Tickets'),
->label(__('app.tickets')),
])
->filters([
SelectFilter::make('type')

View File

@@ -12,7 +12,7 @@ class HandoversRelationManager extends RelationManager
{
protected static string $relationship = 'handovers';
protected static ?string $title = 'Handovers';
protected static ?string $title = 'app.handovers';
public function table(Table $table): Table
{
@@ -20,11 +20,11 @@ class HandoversRelationManager extends RelationManager
->recordTitleAttribute('status')
->columns([
TextColumn::make('customer.name')
->label('Customer')
->label(__('app.widget_customer'))
->searchable()
->sortable(),
TextColumn::make('handover_date')
->label('Ngày BG')
->label(__('app.handover_date'))
->date('d/m/Y')
->sortable(),
TextColumn::make('status')
@@ -38,7 +38,7 @@ class HandoversRelationManager extends RelationManager
})
->formatStateUsing(fn (string $state): string => HandoverStatus::from($state)->label()),
TextColumn::make('remark')
->label('Ghi chú')
->label(__('app.remark'))
->limit(50)
->toggleable(),
TextColumn::make('created_at')

View File

@@ -12,7 +12,7 @@ class ProductServicesRelationManager extends RelationManager
{
protected static string $relationship = 'productServices';
protected static ?string $title = 'Services';
protected static ?string $title = 'app.services';
public function table(Table $table): Table
{
@@ -38,11 +38,11 @@ class ProductServicesRelationManager extends RelationManager
default => 'gray',
}),
TextColumn::make('actual_collection_date')
->label('Ngày thu')
->label(__('app.collection_date'))
->date('d/m/Y')
->sortable(),
TextColumn::make('remark')
->label('Ghi chú')
->label(__('app.remark'))
->limit(50)
->toggleable(),
TextColumn::make('created_at')
@@ -55,10 +55,10 @@ class ProductServicesRelationManager extends RelationManager
->options(ServiceType::MANAGEMENT_FEE->options()),
SelectFilter::make('status')
->options([
'active' => 'Active',
'pending' => 'Pending',
'completed' => 'Completed',
'cancelled' => 'Cancelled',
'active' => __('app.status_active'),
'pending' => __('app.status_pending'),
'completed' => __('app.status_completed'),
'cancelled' => __('app.status_cancelled'),
]),
])
->defaultSort('created_at', 'desc')

View File

@@ -17,15 +17,17 @@ class ProductForm
Section::make()
->schema([
TextInput::make('name')
->label(__('app.name'))
->required()
->maxLength(255),
Textarea::make('description')
->label(__('app.description'))
->columnSpanFull(),
Select::make('status')
->options([
'active' => 'Active',
'inactive' => 'Inactive',
'sold_out' => 'Sold Out',
'active' => __('app.status_active'),
'inactive' => __('app.status_inactive'),
'sold_out' => __('app.status_sold_out'),
])
->default('active')
->required(),

View File

@@ -31,7 +31,7 @@ class ProductsTable
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('customers_count')
->counts('customers')
->label('Owners'),
->label(__('app.owners')),
TextColumn::make('created_at')
->dateTime()
->sortable()
@@ -40,9 +40,9 @@ class ProductsTable
->filters([
SelectFilter::make('status')
->options([
'active' => 'Active',
'inactive' => 'Inactive',
'sold_out' => 'Sold Out',
'active' => __('app.status_active'),
'inactive' => __('app.status_inactive'),
'sold_out' => __('app.status_sold_out'),
]),
])
->recordActions([