Monday, 15 February 2010

codeigniter - codeigniter_i18n multi language -



codeigniter - codeigniter_i18n multi language -

i read , follow instruction link codeigniter_i18 multilanguage , it's works, have little problem here, don't know maybe @ routes config or scripts.

for example, http://mysite.com en default language in index of site, if want alter different language instance dutch, how implement can url http://mysite.com/nl/

thanks in advance

using in path makes things lot more complicated, because need first segment country code (so need utilize /en english)

an easier method consider set session variable when select language, , "in background":

in my_controller:

public function __construct() { parent::__construct(); $lang_code = ($this->session->userdata('lang_code'))? $this->session->userdata('lang_code'):'english'; $this->lang->load('project_launch', $lang_code); $this->lang->load('project_launch_template', $lang_code); $this->lang->load('project_launch_uploader', $lang_code); } function lang_select(){ $lang_code = $this->input->post('lang_code'); $this->session->set_userdata('lang_code', $lang_code ); }

and have language selector (dropdown, little flags, whatever) phone call lang_select() alter language & set session variable; build check language each page load , load appropriate language files

codeigniter multilanguage codeigniter-url

No comments:

Post a Comment