CodeIgniter Forums
How to load different language at real time? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: How to load different language at real time? (/showthread.php?tid=14436)



How to load different language at real time? - El Forum - 01-02-2009

[eluser]mihu[/eluser]
I would like to provide multiple languages capability.

The way I did is loading the language within constructor.
Code:
$this->load->library('text');

// ... get language option from user

$this->lang->load('xxx', $language);

However, this will not work for some class like validation, since it's codeigniter library.
Is there anyway to load the system language on demand for core library?

Best,

Thanks in advance.


How to load different language at real time? - El Forum - 01-02-2009

[eluser]Developer13[/eluser]
I think that should work provided you have the specified CI language files installed in system/language... at least this is what makes sense to me off the top of my head.


How to load different language at real time? - El Forum - 01-03-2009

[eluser]Pascal Kriete[/eluser]
You can dynamically set the language config item, which will then be used as the default throughout the application:

Code:
$this->config->set_item('language', $theuserslanguage);



How to load different language at real time? - El Forum - 01-06-2009

[eluser]mihu[/eluser]
@Developer13

I did provided the language file which I download from CodeIgniter site.
Thanks for response.

@pascal Kriete

Thanks so much. This works.