Intervention / Intervention/validation
Package seems to cause translation errors in other packages
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 678
- Forks
- 68
- Avg merge
- 9m
- Merged PRs (30d)
- 1
Description
It seems that this package causes translation errors in Laravel Nova (see this issue https://github.com/laravel/nova-issues/issues/4192).
By calling a translation in a constructor the incorrect locale is set for the App (https://github.com/laravel/nova-issues/issues/4192#issuecomment-1120249039)
I think this is what is happening with this package in the file validation/src/Laravel/ValidationServiceProvider.php.
From the boot() function $this->getErrorMessage() is called and this calls
return $this->app['translator']->get('validation::validation.' . $rulename);. (https://github.com/Intervention/validation/blob/master/src/Laravel/ValidationServiceProvider.php#L48)
When I comment this out or replace it with return ''; the translation errors in Laravel Nova disappear.
I am using php8, laravel/framework 9.26.1, laravel/nova 4.13.0, intervention/validation 3.2.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in validation/src/Laravel/ValidationServiceProvider.php, especially boot() and getErrorMessage(), then review the linked Laravel Nova issue for the reported locale behavior. Reproduce with PHP 8, Laravel 9.26.1, Nova 4.13.0, and intervention/validation 3.2.0; done means the translation errors no longer occur without breaking validation messages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- laravel, php
- Domain
- backend, localization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100