laravel-localization icon indicating copy to clipboard operation
laravel-localization copied to clipboard

error when using optional params in route file

Open nickbr5 opened this issue 7 years ago • 3 comments

Hi,

I'm having troubles with the package when using optional parameters in my translated routes.

I use {{LaravelLocalization::localizeURL('partners')}} in my view.

I have a route file NL which contains "partners" => "partners/{confirmed?}". I have a route file FR which contains "partners" => "partenaires/{confirmed?}". The result of localizeURL always returns the default url => dev.localhost/fr/partners. If i delete the optional params or i make them required everything works perfectly. I'm using the lastest version of the package and L5.2.

Any ideas?

thx

nickbr5 avatar Nov 10 '16 14:11 nickbr5

Have you tried passing null or empty values as optional parameter? Can't find where I used it but I recall doing it.

Hope it helps.

afontcu avatar Nov 10 '16 15:11 afontcu

@afontcu Yes, i also tried {{LaravelLocalization::getLocalizedURL(null,'partners',array('confirmed'=>1)}}. This gives the same result => dev.localhost/fr/partners, no translation took place.

nickbr5 avatar Nov 10 '16 15:11 nickbr5

Same problem like @nickbr5. I'm using the latest version of the Laravel 5.3.

lukasfiala avatar Nov 15 '16 12:11 lukasfiala