Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPStan rule to catch bad translation keys #5

Closed
GuySartorelli opened this issue Feb 6, 2024 · 1 comment
Closed

PHPStan rule to catch bad translation keys #5

GuySartorelli opened this issue Feb 6, 2024 · 1 comment

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented Feb 6, 2024

Description

It's far too easy to make mistakes when writing translation keys for localisable strings, e.g. missing out the period between the class name and the unique key.

e.g:

_t(__CLASS__ . 'PERMISSIONS_CATEGORY', 'Dev permissions');

which results in:

php.SilverStripe\Dev\DevelopmentAdminPERMISSIONS_CATEGORY: 'Dev permissions'

It should be like this instead:

_t(__CLASS__ . '.PERMISSIONS_CATEGORY', 'Dev permissions');

We should write a PHPStan rule to catch these errors.

PRs

After merging, reassign to Guy to tag a new minor

@GuySartorelli
Copy link
Member Author

PR merged and new minor tagged

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

No branches or pull requests

2 participants