User switching locale - 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: User switching locale (/showthread.php?tid=77968) |
User switching locale - berendbotje91 - 11-12-2020 I have content negotiation on for the locale. But is it possible to have a user switch locale without going the route way? RE: User switching locale - T.O.M. - 11-12-2020 You may use "$this->request->setLocale()" and "$this->request->getLocale()" methods to set and get locale from request and do not use URL segment - https://codeigniter.com/user_guide/outgoing/localization.html#retrieving-the-current-locale RE: User switching locale - berendbotje91 - 11-12-2020 (11-12-2020, 02:12 AM)T.O.M. Wrote: You may use "$this->request->setLocale()" and "$this->request->getLocale()" methods to set and get locale from request and do not use URL segment - https://codeigniter.com/user_guide/outgoing/localization.html#retrieving-the-current-localeAh thanks! I didn't see setLocale() in the guide which I already thought was weird. RE: User switching locale - T.O.M. - 11-12-2020 Yes, I faced the same problem until I looked to the source code |