Open cweiske opened 1 year ago
I solved my problem by manually defining the service provider order in my config/app.php
:
'providers' => [
// [...] my own providers here, and after them:
//translator needs to be after \Laravel\Nova\NovaServiceProvider
Laravel\Nova\NovaServiceProvider::class,
Msurguy\Honeypot\HoneypotServiceProvider::class,
],
When installing this Honeypot package, my custom translations from
.json
translation files are not available in Laravel Nova.I know of one other package that exhibits the same problem: Intervention/validation #59 and whitecube/nova-flexible-content - laravel/nova-issues/ #4192. Nova issues are: https://github.com/laravel/nova-issues/issues/2505, https://github.com/laravel/nova-issues/issues/2515, https://github.com/laravel/nova-issues/issues/3767
The problem is that since #13, the translator is loaded when the app is booted:
Nova's own service provider registers its custom translations that way (nova 2.12.0):
Translator::addJsonPath
only registers a file path that will get loaded later. Unfortunately, because HoneypotServiceProvider already used the translator, the translator will never load the additional json file.One solution could be that the HoneypotServiceProvider gets loaded after the NovaServiceProvider. Another way would be to load the translation only when it's needed, and not already in the boot process.