Closed
Description
I have a language switch bar that has to generate the URL for the current page in all supported languages.
To do that I have to subscribe to the routes.translation event, but isn't so simple.
When I execute this
LaravelLocalization::getLocalizedURL($localeCode); // Where $localeCode is "en", "fr", etc.
with this
Event::listen('routes.translation', function ($locale, $attributes)
{
foreach ($attributes as $name => $value)
{
$attributes[$name] = $translatedValue; // get the transated attribute for the given $locale
}
return $attributes;
});
I get this error
ErrorException in routes.php line 38:
Missing argument 2 for App\Providers\RouteServiceProvider::{closure}() (View: D:\Progetti\instalmec.it\Instalmec\resources\views\header.blade.php) (View: D:\Progetti\instalmec.it\Instalmec\resources\views\header.blade.php)
Why? I followed your docs but doesn't work as expected.
I see that the first parameter is the attributes array, but should be the second, right?
See entire logs if needed.
Metadata
Metadata
Assignees
Labels
No labels