Skip to content

Add translatable subuser permission labels#2185

Closed
lancepioch wants to merge 5 commits intomainfrom
lance/2069
Closed

Add translatable subuser permission labels#2185
lancepioch wants to merge 5 commits intomainfrom
lance/2069

Conversation

@lancepioch
Copy link
Member

@lancepioch lancepioch commented Feb 6, 2026

Resolves #2069

Adds translatable labels for built-in subuser permission tabs and graceful fallback for missing translations. When a translation key doesn't exist (e.g. plugin-provided custom permissions), the UI falls back to headline() for labels and null for descriptions instead of showing raw translation keys.

Adds a translationPrefix parameter to Subuser::registerCustomPermissions() so plugins can provide their own namespaced translations. For example:

Subuser::registerCustomPermissions(
    name: 'my-feature',
    permissions: ['read', 'write', 'delete'],
    icon: TablerIcon::Settings,
    translationPrefix: 'my-plugin::permissions.',
);

The plugin would then provide translations at keys like:

  • my-plugin::permissions.my-feature (tab label)
  • my-plugin::permissions.my-feature_desc (group description)
  • my-plugin::permissions.my-feature_read (individual permission description)

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

This change implements translation support for custom subuser permissions. The SubuserResource was updated to conditionally load permission descriptions and section labels from language files with fallback logic when translations are unavailable. Ten new permission group translation keys were added to the English language file.

Changes

Cohort / File(s) Summary
Subuser Permission Translations
app/Filament/Server/Resources/Subusers/SubuserResource.php
Modified permission description and section label rendering to use conditional translation lookups with trans(), falling back to null or original values when translation keys don't exist.
Permission Group Language Keys
lang/en/server/user.php
Added 10 new permission group translation keys: control, user, file, backup, schedule, database, allocation, startup, settings, and activity.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding translatable labels for subuser permissions.
Linked Issues check ✅ Passed The PR implements translatable permission labels for subusers with graceful fallbacks, directly addressing the objective stated in issue #2069.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing translatable subuser permission labels: modifications to SubuserResource.php and additions to translation keys in lang/en/server/user.php.
Description check ✅ Passed The pull request description clearly relates to the changeset, detailing the addition of translatable labels for subuser permission tabs and the implementation of graceful fallbacks for missing translations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member

@Boy132 Boy132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not resolve #2069. The issue is about custom subuser permissions from plugins. Because plugin translations are under the namespace of the plugin there is no translation for these custom permissions.

@lancepioch lancepioch marked this pull request as draft February 6, 2026 15:37
Adds a translationPrefix parameter to registerCustomPermissions() so
plugins can specify their own namespaced translation keys instead of
being limited to the panel's server/user.permissions.* keys.
@Boy132 Boy132 closed this Feb 24, 2026
@Boy132 Boy132 deleted the lance/2069 branch February 24, 2026 14:47
@github-actions github-actions bot locked and limited conversation to collaborators Feb 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translations for custom subuser permissions

3 participants