Force admin panel to be just in English
Created 6 years ago by pooria

Hi

I have set the default locale for the website to another language but I would like to force the admin panel to always show in English. What should I do?

ryanthompson  —  6 years ago Best Answer

Hmm.. I think you could use a simple middleware to force the locale if the routing matches admin/*. You can setup middleware like you typically would in Laravel or using streams/config.php OR in your theme or something too.

pooria  —  6 years ago

@ryanthompson But I couldn't find streams/config.php. Also I really don't understand what streams really are! But the Laravel way is OK. I just thought that there would be a Pyro way (like if (is_admin()) {)

ryanthompson  —  6 years ago

Sorry that was my mistake.. config/streams.php is the config file. I must have been rushing out the door or something :-/

pooria  —  6 years ago

@ryanthompson 😄)) . Thanks.

pooria  —  6 years ago

For those who need help:

if($request->segment(1) == 'admin')  {
      $request->session()->put('_locale', 'en');
} else {
      $request->session()->remove('_locale');
}