Skip to content

Make enum, role and permission labels translatable - #803

Merged
nielsdrost7 merged 2 commits into
InvoicePlane:developfrom
TheFreeman:fix/translatable-enum-labels
Oct 26, 2026
Merged

nielsdrost7 merged 2 commits into
InvoicePlane:developfrom
TheFreeman:fix/translatable-enum-labels

Conversation

@TheFreeman

@TheFreeman TheFreeman commented Oct 25, 2026 •

Copy link
Copy Markdown

Pull Request Checklist

Checklist

  • My code follows the code formatting guidelines. (Laravel Pint checked.)
  • I have tested my changes locally. (Branch-specific results below.)
  • I selected the appropriate branch for this PR. (develop.)
  • I have rebased my changes on top of the selected branch. (Rebased on develop commit 252564ded3810ba9ca62f0aec11c85b801f291c4 after Respect profile language in panels, Livewire and account mail #802 was merged on 2026-10-25.)
  • I included relevant documentation updates if necessary. (No separate user-guide update is needed for this targeted change; behavior and validation are documented below.)
  • I have an accompanying issue ID for this pull request.

Description

Route hardcoded enum display labels and permission names through English source catalogues. Translate known role names on the permissions page while retaining the fallback for custom roles.

Enum backing values, permission and role identifiers, colors and authorization behavior remain unchanged. No German catalogue is included; translations can follow through Crowdin after the source keys are accepted.

Related Issue(s)

No dedicated accompanying issue has been identified or linked. The issue-ID checklist item remains open; this PR does not claim to close an issue.

Previous review package: #802, now merged. This branch is rebased on the resulting develop; its diff contains only enum, role and permission label changes and their tests.

Relevant .github/CHECKLIST.md rows: core / layout and settings, expenses, payments, projects — Translations.

Motivation and Context

Changing the application locale currently leaves status/type choices and the role-permissions page partly in English because their display labels are hardcoded. Source translation keys allow those existing labels to follow the active locale while preserving stored values and access checks.

This is the next focused package for review after the profile-language fix in #802 was merged. Larger form-label and document-format changes are held in the fork; see the contribution sequence.

Issue Type

  • Bugfix
  • Improvement of an existing feature
  • New feature

Validation

php artisan test --filter=EnumLocalizationTest

2 tests / 8 assertions passed on this independent branch at 50cb28971ff076e97de2cfa89c3cca4293f172bc (PHP 8.4, locked dependencies), without German catalogue files. Coverage includes changing the locale at runtime and keeping storage/permission values stable. Laravel Pint formatting was checked. Test methods use grammatical it_ names and explicit Arrange, Act, Assert sections; assertions are separated from the exercised behavior. The local results above were rechecked after this test-only follow-up. These results describe local validation, not an assertion that upstream CI has passed.

After rebasing on the merged profile-language package, the combined locale, real Livewire-update, menu and enum tests passed: 13 tests / 52 assertions. Command:

php artisan test --filter='UserLocaleTest|UserLocaleLivewireTest|UserMenuLocalizationTest|EnumLocalizationTest'

PHP 8.4, isolated MariaDB and locked dependencies; Pint passed for all 22 changed files.

Screenshots

No screenshot attached: the change makes existing labels translatable and preserves the layout. Tests inject translations to verify the behavior without requiring additional language catalogues.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b3ef8545-7165-4335-9e5a-91505c1e7f39
Commits

Reviewing files that changed from the base of the PR and between 252564d and 50cb289.

Files selected for processing: 22
  • Modules/Clients/Enums/AddressType.php
  • Modules/Clients/Enums/CommunicationType.php
  • Modules/Clients/Enums/RelationType.php
  • Modules/Core/Enums/AddressType.php
  • Modules/Core/Enums/CommunicationType.php
  • Modules/Core/Enums/CustomFieldType.php
  • Modules/Core/Enums/EmailTemplateType.php
  • Modules/Core/Enums/MailType.php
  • Modules/Core/Enums/Permission.php
  • Modules/Core/Enums/ReportBand.php
  • Modules/Core/Enums/TaxRateType.php
  • Modules/Core/Enums/UserRole.php
  • Modules/Core/Enums/UserType.php
  • Modules/Core/Tests/Feature/EnumLocalizationTest.php
  • Modules/Core/resources/views/filament/admin/pages/role-permissions-page.blade.php
  • Modules/Expenses/Enums/ExpenseStatus.php
  • Modules/Expenses/Enums/ExpenseType.php
  • Modules/Invoices/Enums/RecurringFrequency.php
  • Modules/Payments/Enums/PaymentStatus.php
  • Modules/Projects/Enums/ProjectStatus.php
  • resources/lang/en/enums.php
  • resources/lang/en/permissions.php
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@TheFreeman
TheFreeman force-pushed the fix/translatable-enum-labels branch from ef80346 to 50cb289 Compare October 25, 2026 16:28
@TheFreeman
TheFreeman marked this pull request as ready for review October 25, 2026 16:28
@TheFreeman

Copy link
Copy Markdown
Author

@nielsdrost7 PR #803 is now ready for review.

It has been rebased onto develop after #802 was merged.
Pint passes, and the combined localization tests pass:
13 tests, 52 assertions.

This PR only covers translatable enum, role and permission labels.

@nielsdrost7
nielsdrost7 merged commit 0d813cd into InvoicePlane:develop Oct 26, 2026
4 checks passed
@nielsdrost7

Copy link
Copy Markdown
Collaborator

@TheFreeman thanks man!
Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants