codezero-be / laravel-localized-routes

⭐️ A convenient way to set up and use localized routes in a Laravel app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate localized route with parameters

OleVik opened this issue · comments

Something between the Translate Routes and Route Parameters sections of the README is confusing me. I have several named routes, of the form

Route::get(Lang::uri('dashboard/listing/{listing}'), [ContractController::class, 'create'])->name('dashboard.listing.edit');

Which are translated in /resources/lang/nb/routes.php as

'dashboard' => 'konto',
'dashboard/listing' => 'konto/annonse',
'dashboard/listing/{listing}' => 'konto/annonse/{listing}',

As well as /resources/lang/en/routes.php with keys matching values. When I try to generate a link to a specific resource, using {{ route('dashboard.listing.edit', {listing: contract.id} ) }} in Twig, it only works in English.

Specifically, it yields http://127.0.0.1:8000/en/account/listing/103 in English, but http://127.0.0.1:8000/konto/listing/103 in Norwegian.

What would I need to specify to ensure that the second level of the URL is translated as well?

Hi, sorry for the late reply, I suppose it's already been handled by now.
If not... this is now fixed in 2.7.3 👍