How can I change the language of errors in laravel 5.1 dynamically?

I have been using the helper

app()->setLocale(session('lang')); However, I can get to change the languages of views but the languages of errors still continues reading of \config\app.php locale => ‘es’

That means that always show the same language.

How can i change it also dynamically?

The problems is that the partial view that prints the errors always print in the same language.

Here is the code that i have.


<ul class="nav navbar-nav navbar-right">
  <li><a href="{{ url('lang', ['en']) }}">En</a></li>
  <li><a href="{{ url('lang', ['es']) }}">Es</a></li>


Route::get('lang/{lang}', '[email protected]')->where([ 'lang' => 'en|es']); 

Route::group(['middleware' => ['web']], function () { 
Route::get('notes', '[email protected]'); 
Route::get('notes/create', '[email protected]'); 


public function changeLang($lang)
   session(['lang' => $lang]);
   return Redirect::back();


public function handle($request, Closure $next)
   if (!empty(session('lang'))) {
   return $next($request);


   @foreach($errors->all() as $error)
      <li>{{ $error }}</li>

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us