You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
i found some problems with redirection for routes with parameters. When language in my browser/cookie is set to en and then i go directly to translated url with parameters i get 404 error.
Steps to reproduce:
1.) Set your language to en,
2.) Go to page /play/my-lottery
3.)Go to page /jwe/my-lottery - it will redirect you to /en/jwe/my-lottery instead of just /jwe/my-lottery - you get 404 error
So if you use page in 'en' and your friend sends you link in different language you will occur 404. Problem is not visible when i use hideDefaultLocaleInURL = false.
I found that function findTranslatedRouteByPath() may not properly comparing routes which has attributes.
Comparsion looks like:
LEFT: $this->translator->get($translatedRoute, [], $url_locale) = "play/{lottery}"
RIGHT: rawurldecode($path) == "play/my-lottery"
Result: "play/{lottery}" != "play/my-lottery"
Translation cannot be found for routes with params
More info:
Laravel 8
PHP8
LaravelLocalization: 1.6.1
I fixed this behavior with checking params in $path and replacing route attributes for comparrsion.
Is there a bug, or this feature is not implemented yet? Or maybe my configuration is wrong.
The text was updated successfully, but these errors were encountered:
Hi,
i found some problems with redirection for routes with parameters. When language in my browser/cookie is set to en and then i go directly to translated url with parameters i get 404 error.
Example:
.env
APP_LOCALE=fr
APP_SUPPORTED_LOCALES=en,fr
Config:
useAcceptLanguageHeader = true
hideDefaultLocaleInURL = true
Routes:
EN:
"play_single" => "play/{lottery}",
FR:
"play" => "jwe/{lottery}",
Steps to reproduce:
1.) Set your language to en,
2.) Go to page /play/my-lottery
3.)Go to page /jwe/my-lottery - it will redirect you to /en/jwe/my-lottery instead of just /jwe/my-lottery - you get 404 error
So if you use page in 'en' and your friend sends you link in different language you will occur 404. Problem is not visible when i use hideDefaultLocaleInURL = false.
I found that function findTranslatedRouteByPath() may not properly comparing routes which has attributes.
Comparsion looks like:
LEFT: $this->translator->get($translatedRoute, [], $url_locale) = "play/{lottery}"
RIGHT: rawurldecode($path) == "play/my-lottery"
Result: "play/{lottery}" != "play/my-lottery"
Translation cannot be found for routes with params
More info:
Laravel 8
PHP8
LaravelLocalization: 1.6.1
I fixed this behavior with checking params in $path and replacing route attributes for comparrsion.
Is there a bug, or this feature is not implemented yet? Or maybe my configuration is wrong.
The text was updated successfully, but these errors were encountered: