Change language dynamically in CodeIgniter 4 - 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: Change language dynamically in CodeIgniter 4 (/showthread.php?tid=78345) |
Change language dynamically in CodeIgniter 4 - ciddict - 01-06-2021 Hi, How can I assign config("App")->defaultLocale in a controller function? So I can use it dynamically without changing the value in Config/App.php Thanks in advance. RE: Change language dynamically in CodeIgniter 4 - berendbotje91 - 01-07-2021 Instead of changing the default, you can change it using the request with "$this->request->setLocale()". You can also retrieve the current one with "$this->request->getLocale()" (https://forum.codeigniter.com/post-381677.html#pid381677 and https://codeigniter.com/user_guide/outgoing/localization.html#retrieving-the-current-locale) RE: Change language dynamically in CodeIgniter 4 - ciddict - 01-07-2021 @berendbotje91, it worked. Thank you so much. |