CodeIgniter Forums
Switch system language - 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: Switch system language (/showthread.php?tid=61314)



Switch system language - nvcleemp - 04-07-2015

I'm using CodeIgniter 3.0. I'm writing a multilingual website. The website is not text-heavy, so it was not much work using the Language class and the documentation on the internet is plenty. However, what I was unable to find is documentation on switching the system language.

In config.php I have set the language to 'english'. This means that if my user sets a different language the system messages, e.g., from form validation, are still in English. How can I switch the language for those type of messages?


RE: Switch system language - mwhitney - 04-08-2015

Generally, you just have to get the user's language selection early enough to set the language, or reload any language files which are loaded previous to your retrieval of that selection.


RE: Switch system language - gadelat - 04-08-2015

PHP Code:
$this->config->set_item('language''slovak'); 



RE: Switch system language - nvcleemp - 04-08-2015

Thanks. The combination of both answers was exactly what I needed.