Welcome Guest, Not a member yet? Register   Sign In
Change language dynamically in CodeIgniter 4
#1

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.
Reply
#2

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-38167...#pid381677 and https://codeigniter.com/user_guide/outgo...ent-locale)
Reply
#3

@berendbotje91, it worked. Thank you so much. Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB