Skip to content
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

Translated route not redirecting correctly #493

Open
istratos opened this issue Sep 24, 2017 · 2 comments
Open

Translated route not redirecting correctly #493

istratos opened this issue Sep 24, 2017 · 2 comments

Comments

@istratos
Copy link

istratos commented Sep 24, 2017

Utilizing all 4 middleware for this procedure.

Route::group([
    'prefix' => LaravelLocalization::setLocale(),
    'middleware' => [
        'localize',
         'localeSessionRedirect',
        'localizationRedirect',
        'localeViewPath'
    ]
], function()
{
    Route::get(LaravelLocalization::transRoute('routes.contact'), 'PageController@contact')->name('contact');
});

'hideDefaultLocaleInURL' => true,

Supporting english (default) and spanish

English route:
/contactus

Spanish route:
/es/contacto

If current locale is EN (English):
/contactus shows english page fine. (correct)
/en/contactus redirects to /contactus (correct)
/contacto shows 404 (should redirect to /es/contacto)
/es/contacto shows spanish page fine. (correct)

If current locale is ES (Spanish):
/contactus redirects to es/contacto (correct because sessionredirect)
/en/contactus redirects to /contactus (correct)
/contacto shows 404 (should redirect to /es/contacto)
/es/contacto shows spanish page fine. (correct)

So in short, the localized uri name won't ever work. /contacto route should redirect to es/contacto rather than showing a 404.

Why is this?

Laravel 5.5
Laravel-localization 1.3.2

@istratos istratos changed the title Translated route not redirecting if current locale does not match. Translated route not redirecting correctly Sep 24, 2017
@dorinesinenco
Copy link

+1, Subscribe to this issue.
Same goes in my case, we have 2 projects where
/test/{param}
/ru/тест/{param} works on default language
but when switching to the translated counterpart the route becomes
/тест/{param}
/ru/тест/{param}
laravel 5.5
Laravel-localization 1.3.2

@aydinfatih
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants