![]() |
Change language runtime - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Change language runtime (/showthread.php?tid=80613) |
Change language runtime - omid_student - 11-21-2021 Hi On my shop website, I need to change shop language auto with user IP For example, if a user is from Turkey, so load Turkey language or English language for America I load English language default I try to change the language in the config file but I cannot use the $this->db command and got error I have country IPs in database and use query for detect user country with ip And that is important check IP before set $config['language'] parameter Thanks RE: Change language runtime - hxd - 11-21-2021 Please read this docs https://codeigniter.com/user_guide/outgoing/localization.html#locale-detection RE: Change language runtime - omid_student - 11-22-2021 (11-21-2021, 09:09 PM)hxd Wrote: Please read this docs That is Codeigniter 4 and I'm still on Codeigniter 3 My question is change language runtime RE: Change language runtime - sammyskills - 11-22-2021 Well, since you already have a way of detecting a user's country, I believe you are already close to what you are looking for. From the docs, you will need to store the particular language of a user in the session. So, you can use that to automatically display the current page/language to the user. PHP Code: $idiom = $this->session->get_userdata('language'); RE: Change language runtime - alanmark1 - 11-24-2021 (11-21-2021, 08:43 AM)omid_student Wrote: Hi (11-21-2021, 09:09 PM)hxd Wrote: Please read this docsthanks a lot! RE: Change language runtime - miyaw21 - 11-25-2021 (11-21-2021, 09:09 PM)hxd Wrote: Please read this docs Thanks alot Sir! RE: Change language runtime - InsiteFX - 11-25-2021 Here is how to get it with php. How to detect Browser Language in PHP? Make sure you do not have any security issues in your method with this code. |