Welcome Guest, Not a member yet? Register   Sign In
Multilanguage support
#1

[eluser]codeninja[/eluser]
I am trying to get a simple URL based language selection working with CI2.0 with HMVC.

I have customized routes like:

$route['login'] = 'users/login';


Now I want to do the following:

http://localhost/en/login -> to call users/login
http://localhost/fr/login -> to call users/login

Any ideas on how to implement this?

I tried to follow this but didn't work for me.. http://codeigniter.com/wiki/CI_Language_Extended/
#2

[eluser]smilie[/eluser]
I am using language as a stored value in a session...
Much easier :-)

Simply, whenever you are calling DB or a page, you do:

$this->load->lang('filename',$this->session->userdata('language'));

This opens the language file, based on the language in a user session.

Same goes for example db data which is also language set. For example

$db->select('field1,field2')->from('table')->where('lang',$this->session->userdata('language'));

Cheers,
Smilie
#3

[eluser]Xoan SampaiƱo[/eluser]
[quote author="codeninja" date="1289179944"]I am trying to get a simple URL based language selection working with CI2.0 with HMVC.

I have customized routes like:

$route['login'] = 'users/login';


Now I want to do the following:

http://localhost/en/login -> to call users/login
http://localhost/fr/login -> to call users/login

Any ideas on how to implement this?

I tried to follow this but didn't work for me.. http://codeigniter.com/wiki/CI_Language_Extended/[/quote]

http://maestric.com/doc/php/codeigniter_i18n




Theme © iAndrew 2016 - Forum software by © MyBB