You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The easiest way to create a translation file is using the `shield:translation` command:
625
+
626
+
```bash
627
+
php artisan shield:translation en --panel=admin
648
628
```
649
-
**Example output:** running the above in the Filament Demo app context, with `custom_permissions` => ['Impersonate:User', 'View:IconLibrary'] will give you the following output:
629
+
630
+
This generates a file at `lang/en/shield-permissions.php` containing all permission labels:
631
+
650
632
```php
651
-
[
652
-
"view_any",
653
-
"view",
654
-
"create",
655
-
"update",
656
-
"delete",
657
-
"restore",
658
-
"force_delete",
659
-
"force_delete_any",
660
-
"restore_any",
661
-
"replicate",
662
-
"reorder",
663
-
"products_cluster",
664
-
"stats_overview_widget",
665
-
"orders_chart",
666
-
"customers_chart",
667
-
"latest_orders",
668
-
"impersonate:_user",
669
-
"view:_icon_library",
670
-
]
633
+
<?php
634
+
635
+
/**
636
+
* Shield Permission Labels
637
+
*
638
+
* Translate the values below to localize permission labels in your application.
639
+
*/
640
+
641
+
return [
642
+
// Resource affixes
643
+
'create' => 'Create',
644
+
'delete' => 'Delete',
645
+
'delete_any' => 'Delete Any',
646
+
'force_delete' => 'Force Delete',
647
+
'force_delete_any' => 'Force Delete Any',
648
+
'replicate' => 'Replicate',
649
+
'reorder' => 'Reorder',
650
+
'restore' => 'Restore',
651
+
'restore_any' => 'Restore Any',
652
+
'update' => 'Update',
653
+
'view' => 'View',
654
+
'view_any' => 'View Any',
655
+
656
+
// Pages (permission key in snake_case)
657
+
'view_dashboard' => 'Dashboard',
658
+
659
+
// Widgets (permission key in snake_case)
660
+
'view_stats_overview' => 'Stats Overview',
661
+
662
+
// Custom permissions
663
+
'approve_posts' => 'Approve Posts',
664
+
];
671
665
```
672
666
673
-
### Default
674
-
if you want to use the default translations provided by the package for the commonly used set of permissions for resources, you can set the `localization.key` in the config as `localization.key' => 'filament-shield::filament-shield.resource_permission_prefixes_labels'` and enable localization by setting `localization.enabled` to `true`.
667
+
### Translation Keys
668
+
669
+
All translation keys are in **snake_case** format:
670
+
671
+
| Permission Type | Original Key | Translation Key |
Upgrading from `3.x|4.0.0-Beta*` versions to 4.x requires careful consideration due to significant changes in the package's architecture and functionality. Here are the key steps and considerations for a successful upgrade:
0 commit comments