Иван Желев
Иван Желев

Reputation: 87

Laravel localization problems 5.2+

This is my middleware.

class BeforeMiddleware{

public function handle($request, Closure $next)
{
    // Perform action

    App:setLocale(LC_ALL,Session::get('locale'));

    return $next($request);
}

If i don't place LC_ALL as first parameter in setLocale i get this error.

"setlocale() expects at least 2 parameters, 1 given"

If i put LC_ALL as the first parameter localization doesn't change. Version of laravel is 5.2+

Upvotes: 1

Views: 2026

Answers (2)

samair ali
samair ali

Reputation: 802

setlocale with out capital L this function is php function which takes 2 parameters in laravel you have to use App::setLocale with two colons ...

Upvotes: 2

Иван Желев
Иван Желев

Reputation: 87

I've change App::setLocale to app()->setLocale(Session::get('locale')); and looks like it works fine.

Upvotes: 1

Related Questions