CodeIgniter Forums
switching default lang in config.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: switching default lang in config.php (/showthread.php?tid=33692)



switching default lang in config.php - El Forum - 09-05-2010

[eluser]Ngulo[/eluser]
hi all,

i'm wondering how to switch language in my site...

I've some different language packs in my /language directory.

this is the scheme:
Code:
-language
    -en
    ----en_lang.php
    -pt
    ----pt_lang.php
    -sp
    ----sp_lang.php

now i would like to switch the default language into config.php ($config['language'])
by a session data that i use to set like this:
Code:
$param = $this->uri->segment(3);
$this->session->set_userdata('site_lang',$param)

so where i can retrieve session->userdata('site_lang'); and put my new session site language for all helpers ,libraries and so on... ??
thanks guys Wink


switching default lang in config.php - El Forum - 09-05-2010

[eluser]slowgary[/eluser]
The user guide probably has your answer:
http://ellislab.com/codeigniter/user-guide/libraries/language.html


switching default lang in config.php - El Forum - 09-05-2010

[eluser]Ngulo[/eluser]
eheheheh thanks slow Wink

but i didn't find any answer to my question Sad
I know i can load my personal_lang.php file where i want , but ....for example....if i'm using the form_validation class , form's error messages are taked by the default $lang['language'] directory....if this is true......if i want to switch this directory ,not only for my personal_lang.php file,but also for any libraries i'm using in my controllers,what i've to do?

hope you understand my bad english Tongue


switching default lang in config.php - El Forum - 09-05-2010

[eluser]slowgary[/eluser]
I don't really have any experience working with multi-language sites, but I searched the forums for "form validation language" and there are plenty of posts that seem to deal with this same issue. You should check them out.


switching default lang in config.php - El Forum - 09-06-2010

[eluser]Ngulo[/eluser]
yes slowgary thanks for suggest.....

i've found this $this->config->config['language'] = $language_i_want;


i think this could be the solution Wink

really thanks Wink