Using Laravel 5.2.41
Using following translation package: mcamara/laravel-localization
Link inside my view :
<a href="{{ LaravelLocalization::getLocalizedURL(null, trans('routes.account-edit'), ["id" => Auth::user()->id]) }}"> Edit Link</a>
routes.php files inside Lang/fr & Lang/nl
<?php
return [
'account-edit' => "account/wijzig-gegevens/{id}",
];
<?php
return [
'account-edit' => "donnees/modifier-donnees/{id}",
];
Laravel routes file:
Route::group([
'prefix' => LaravelLocalization::setLocale(),
'middleware' => ['localize','localeSessionRedirect', 'localizationRedirect' ]
], function()
{
Route::get(LaravelLocalization::transRoute('routes.account-edit'),'AccountController@edit');
});
When i look at the link in my default language (nl) i get the correct link like so:
<a href="http://blabla.dev/nl/account/wijzig-gegevens/1">Edit Link</a>
But when i change my language to french i get following link:
<a href="http://blabla.dev/fr/donnees/modifier-donnees/{id}">Edit Link</a>
Can't figure out why this is happening
trans('routes.account-edit')
, in your...::getLocalizeURL(...
. Try to remove it. - Thomas Van der Veentrans()
function on the normalroute()
function,dd()
return values, etc.. I think I'm not able to help you any further :( - Thomas Van der Veen