![]() |
LOCALE IS BEING SET TO DEFAULT BECAUSE OF URI FILTER - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: LOCALE IS BEING SET TO DEFAULT BECAUSE OF URI FILTER (/showthread.php?tid=83410) |
LOCALE IS BEING SET TO DEFAULT BECAUSE OF URI FILTER - SubrataJ - 09-23-2022 I have a multilanguage site which was working fine until I had to create a filter for checking permission from the routes page, this is my permission filter:- PHP Code: public function before(RequestInterface $request, $arguments = null) PHP Code: $routes->get('admin/settings/roles/permission', 'RolesController::permission', ['filter' => 'permission:role_permission_view']); if I remove this filter part from routes, multilanguage is working fine, but with this filter, the locale is being set to 'en' by default. RE: LOCALE IS BEING SET TO DEFAULT BECAUSE OF URI FILTER - InsiteFX - 09-24-2022 Then there is something in your filter that is either blocking or over writing the local from being set. Maybe your redirect is by passing the local. RE: LOCALE IS BEING SET TO DEFAULT BECAUSE OF URI FILTER - SubrataJ - 09-24-2022 (09-24-2022, 12:59 AM)InsiteFX Wrote: Then there is something in your filter that is either blocking or over writing the local from being set. I am setting the locale from a very separate controller there is no way permission filter can be a reason, though I am not sure about the insights. Controller where I am setting locale-: PHP Code: class Language extends BaseController and locale filter to set locale PHP Code: public function before(RequestInterface $request, $arguments = null) RE: LOCALE IS BEING SET TO DEFAULT BECAUSE OF URI FILTER - InsiteFX - 09-25-2022 Most users set it in the BaseController. Here is IncludeBeer's Site that shows how they did it. Creating a multilingual website with CodeIgniter 4 (part 1) Creating a multilingual website with CodeIgniter 4 (part 2) |