pooria - 1 month ago

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?

Answer

ryanthompson - 1 month ago

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.

ryanthompson - 1 month ago

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 - 1 month 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 - 1 month ago

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

pooria - 1 month ago

@ryanthompson :))) . Thanks.

pooria - 3 weeks ago

For those who need help:

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