Skip to content

Commit

Permalink
Merge pull request #4 from Log1x/chore/missing-translations
Browse files Browse the repository at this point in the history
🌐 Translate the menu resource forms
  • Loading branch information
datlechin authored Aug 8, 2024
2 parents 65edc73 + 1ad7d88 commit 38116e4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
12 changes: 12 additions & 0 deletions resources/lang/en/menu-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
'title' => 'Title',
'url' => 'URL',
],
'resource' => [
'name' => [
'label' => 'Name',
],
'locations' => [
'label' => 'Locations',
'description' => 'Choose where to display the menu.',
],
'is_visible' => [
'label' => 'Visible',
],
],
'actions' => [
'add' => [
'label' => 'Add to Menu',
Expand Down
12 changes: 12 additions & 0 deletions resources/lang/vi/menu-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
'title' => 'Tiêu đề',
'url' => 'URL',
],
'resource' => [
'name' => [
'label' => 'Tên',
],
'locations' => [
'label' => 'Vị trí',
'description' => 'Chọn vị trí hiển thị menu.',
],
'is_visible' => [
'label' => 'Hiển thị',
],
],
'actions' => [
'add' => [
'label' => 'Thêm vào Menu',
Expand Down
12 changes: 6 additions & 6 deletions src/Resources/MenuResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ public static function form(Form $form): Form
->columns(1)
->schema([
TextInput::make('name')
->label('Tên')
->label(__('filament-menu-builder::menu-builder.resource.name.label'))
->required(),
CheckboxList::make('locations')
->bulkToggleable()
->visible(fn (string $context) => $context === 'edit' && $locations)
->label('Vị trí')
->label(__('filament-menu-builder::menu-builder.resource.locations.label'))
->afterStateHydrated(fn (Menu $menu, Set $set) => $set('locations', $menu->locations->pluck('location')))
->helperText('Chọn vị trí hiển thị menu.')
->helperText(__('filament-menu-builder::menu-builder.resource.locations.description'))
->options($locations),
Toggle::make('is_visible')
->label('Hiển thị')
->label(__('filament-menu-builder::menu-builder.resource.is_visible.label'))
->default(true),
]);
}
Expand All @@ -50,9 +50,9 @@ public static function table(Table $table): Table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable()
->label('Tên'),
->label(__('filament-menu-builder::menu-builder.resource.name.label')),
Tables\Columns\IconColumn::make('is_visible')
->label('Hiển thị')
->label(__('filament-menu-builder::menu-builder.resource.is_visible.label'))
->boolean(),
])
->actions([
Expand Down

0 comments on commit 38116e4

Please sign in to comment.