CodeIgniter Forums

Full Version: Switch system language
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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.
PHP Code:
$this->config->set_item('language''slovak'); 
Thanks. The combination of both answers was exactly what I needed.