Closed sheinfeld closed 2 years ago
Hey @sheinfeld , thanks for the bug report.
For information, this is a trace of what causes the issue:
Carbon::setLocale()
- https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Laravel/ServiceProvider.php#L40\Carbon\Translator
class - https://github.com/briannesbitt/Carbon/blob/95681e675906446864ba8130722b63792fe2d8f4/src/Carbon/Traits/Localization.php#L691\Symfony\Component\Translation\Translator
class - https://github.com/symfony/translation/blob/5.3/Translator.php\Carbon\Translator
- https://github.com/briannesbitt/Carbon/blob/95681e675906446864ba8130722b63792fe2d8f4/src/Carbon/Translator.php#L314getLocale
to get the previous locale before changing it. - https://github.com/briannesbitt/Carbon/blob/95681e675906446864ba8130722b63792fe2d8f4/src/Carbon/Translator.php#L327Then https://github.com/symfony/translation/blob/5.3/Translator.php#L162 is the bit that actually causes a problem - since the base locale isn't found, it calls \Locale::getDefault()
, which presumably works in symfony as \Locale
will be a symfony class, but for Laravel this is the laravel translator, which doesn't have a getDefault()
function.
My only suggestions are to make sure you define an initial locale, setting it in config: https://github.com/laravel/laravel/blob/8.x/config/app.php#L83, and running composer update
. If this doesn't work, it's an issue with carbon so should be raised there.
@tobytwigger that's the thinig... I have set a locale and a fallback_locale...
From the look of it then it looks like a problem with Carbon. If you uninstall this package, does the problem go away? If it doesn't, comment out seconds of the translation service provider to see if you can identify what's causing the problem.
Failing that, raise this with the Carbon library
This was caused by a \Locale
facade being defined in config/app.php
Hi @tobytwigger
After installing your package, I've had some troubles with my laravel app.
Do you have any idea what is the conflict?