-
-
Notifications
You must be signed in to change notification settings - Fork 513
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
404 error when caching routes with locales mapping #761
Comments
To ensure it it not a conflict with my project, I reproduced with a fresh Laravel 6 installation, only adding this dependency and following the installation steps from the readme. |
I got the same problem for my app... |
I may have found a workaround, but I don't know if it's reliable. In LoadsTranslatedCachedRoutes trait, line 27, if we replace: $locale = $localization->setLocale(); with: $locale = $localization->getInversedLocaleFromMapping(
$localization->setLocale()
); it seems to do the job!
You can override the method in your |
@jargoud I am having the same issue, could you share an example of how I can rewrite it in the Update: Found out about this documentation, that solved my issues. |
Hello, i have same problem, i use ur method and it's work, but when i use php artisan optimize, it't doesn't work |
The fix has been merged now! #763 |
If someone else lands on this, php artisan optimize is not using this way of caching and thus crashes the application and shows a 404 if you are using mcamara/laravel-localization. Solution if you are using this pack: Do not use "php artisan optimise". Clear cache by using: |
Hi, same in my project. My routes/web.php look like this:
After |
Describe the bug
When using
localesMapping
to rewritept-BR
locale to simplypt
, it seems to no longer work after I cache route usingcommand. If I clear the cache, it works fine.
The
RouteServiceProvider
is configured as well as the documentation.To Reproduce
de
,en
,fr
,id
,pt-BR
)pt-BR
topt
Expected behavior
Routes should be cached after the locale has been mapped.
More info:
Route::groups
:localeSessionRedirect
,localizationRedirect
,localeViewPath
supportedLocales
,useAcceptLanguageHeader
andhideDefaultLocaleInURL
):The text was updated successfully, but these errors were encountered: