How to get translated(to chosen language) url from named route? (or how to switch language and make Redirect::route(...) to localized link)
I use: php Laravel 4 (L4) mcamara/laravel-localization (LaravelLocalization)
It is simple :) just use
$lang = App:getLocale(); // two letters lang eg. 'en', 'pl'...
return Redirect::to( LaravelLocalization::getURLFromRouteNameTranslated($lang,
'routes.site.dashboard') );
Caution! We assume that routes english translations for key 'site.dashboard' are in file app/lang/en/routes.php
If you have route with parameters for instance: 'companies.edit' => 'companies/{company}/edit'
in routes.php file
then you can use:
$lang = App:getLocale(); // two letters lang eg. 'en', 'pl'...
Redirect::to(LaravelLocalization::getURLFromRouteNameTranslated($lang,
'routes.companies.edit', ['company' => $company->id]) );
That's all :)