From 160442fe5a4a98afa6ab7ac9a30fdbf3e608fa50 Mon Sep 17 00:00:00 2001 From: PTKDrake Date: Mon, 28 Oct 2024 06:40:34 +0700 Subject: [PATCH] Fix default user_name_searchable_columns (#215) Add some missing translation Add Vietnamese translation --- resources/lang/en/filament-spatie.php | 9 ++++ resources/lang/vi/filament-spatie.php | 41 +++++++++++++++++++ src/Resources/PermissionResource.php | 3 +- .../RelationManager/UserRelationManager.php | 2 +- 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 resources/lang/vi/filament-spatie.php diff --git a/resources/lang/en/filament-spatie.php b/resources/lang/en/filament-spatie.php index f0b0cb3..898e77f 100644 --- a/resources/lang/en/filament-spatie.php +++ b/resources/lang/en/filament-spatie.php @@ -14,6 +14,15 @@ 'field.roles' => 'Roles', 'field.role' => 'Role', 'field.team' => 'Team', + 'field.models' => 'Models', + + /* + |-------------------------------------------------------------------------- + | Actions + |-------------------------------------------------------------------------- + */ + + 'action.attach_to_roles' => 'Attach to roles', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/vi/filament-spatie.php b/resources/lang/vi/filament-spatie.php new file mode 100644 index 0000000..b8efd84 --- /dev/null +++ b/resources/lang/vi/filament-spatie.php @@ -0,0 +1,41 @@ + 'Tên Bảo Bệ', + 'field.permissions_count' => 'Số Quyền', + 'field.name' => 'Tên', + 'field.permissions' => 'Các Quyền', + 'field.roles' => 'Các Vai Trò', + 'field.role' => 'Vai Trò', + 'field.team' => 'Nhóm', + 'field.models' => 'Các Mô Hình', + + /* + |-------------------------------------------------------------------------- + | Actions + |-------------------------------------------------------------------------- + */ + + 'action.attach_to_roles' => 'Đính kèm vào vai trò', + + /* + |-------------------------------------------------------------------------- + | Labels + |-------------------------------------------------------------------------- + */ + + 'section.permission' => 'Quyền', + 'section.permissions' => 'Các Quyền', + 'section.role' => 'Vai Trò', + 'section.roles' => 'Các Vai Trò', + 'section.roles_and_permissions' => 'Các Vai Trò và Quyền', + 'select-team' => 'Lựa Chọn Một Nhóm', + 'select-team-hint' => 'Để trống nếu dùng vai trò toàn cục', + 'section.users' => 'Các Người Dùng', +]; diff --git a/src/Resources/PermissionResource.php b/src/Resources/PermissionResource.php index 17b6e40..da09eb5 100644 --- a/src/Resources/PermissionResource.php +++ b/src/Resources/PermissionResource.php @@ -128,7 +128,7 @@ public static function table(Table $table): Table ]) ->filters([ SelectFilter::make('models') - ->label('Models') + ->label(__('filament-spatie-roles-permissions::filament-spatie.field.models')) ->multiple() ->options(function () { $commands = new \Althinect\FilamentSpatieRolesPermissions\Commands\Permission(); @@ -170,6 +170,7 @@ public static function table(Table $table): Table Tables\Actions\DeleteBulkAction::make(), ]), BulkAction::make('Attach to roles') + ->label(__('filament-spatie-roles-permissions::filament-spatie.action.attach_to_roles')) ->action(function (Collection $records, array $data): void { Role::whereIn('id', $data['roles'])->each(function (Role $role) use ($records): void { $records->each(fn (Permission $permission) => $role->givePermissionTo($permission)); diff --git a/src/Resources/RoleResource/RelationManager/UserRelationManager.php b/src/Resources/RoleResource/RelationManager/UserRelationManager.php index 80a3e3a..4b689c9 100644 --- a/src/Resources/RoleResource/RelationManager/UserRelationManager.php +++ b/src/Resources/RoleResource/RelationManager/UserRelationManager.php @@ -58,7 +58,7 @@ public function table(Table $table): Table ->columns([ TextColumn::make(config('filament-spatie-roles-permissions.user_name_column')) ->label(__('filament-spatie-roles-permissions::filament-spatie.field.name')) - ->searchable(config('filament-spatie-roles-permissions.user_name_searchable_columns')), + ->searchable(config('filament-spatie-roles-permissions.user_name_searchable_columns', 'name')), ]) ->filters([