Support the ongoing development of Laravel.io →
posted 10 years ago
Requests

Hi guys, I have a problem, I am making website which has several languages, the URLs of the same action are differend depending on app language selected. I have made route to change app locale and after that I want to redirect user to previuos page, but I cannot do this using Redirect::back(), since after user changed locale, the url's also changed, so I am thinking about passing additional parameter of previuos URL and before I change app locale I want to find out which action/route name represents that URL and redirect using Redirect::route() or Redirect::action(). So is there a way to know what action is behind the URL?

Last updated 2 years ago.
0

You don't need separate routes for multilingual sites. Suppose they change the language in a dropdown, just use some Javascript and redirect to location.pathname + '?lang=' + lang

Then perhaps at the top of the routes or in a service provider:

if (Input::get('lang') {
    App::setLocale(Input::get('lang'));
});

Then use the Language files so you show the correct text.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

luknei luknei Joined 7 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.