benjamincurrie / CodeIgniter-Language-Switch

Codeigniter hook for multi language support, focuses on support for SEO friendly URLs in each language.
15 stars 11 forks source link

question #1

Open tragoro opened 12 years ago

tragoro commented 12 years ago

hello,

I' tried to use your code in a project, but i can't figure out what is the problem.

I use url's like this: http://site.com/index.php?lang=en&page=controller&action=function

I did copy all of your files to codeigniter app.

In controller i have something like this:

.... $this->load->helper('language'); ... $this->lang->load('language_file_name'); ..... and i parse the text to the view $data['text']=$this->lang->line('text');

(is this necessary?)

in your language config i have:

$config['url_style'] = "Query"; $config['languages'] = array('english'=>'English', 'hungarian'=>'Hungarian'); $config['browser_language_detection'] = TRUE; $config['language_codes'] = array( 'en' => 'english', 'hu' => 'hungarian' );

in autoload php you had: $autoload['helper'] = array('uri'); (this gives an error back)

"Unable to load the requested file: helpers/uri_helper.php", so i think you mean $autoload['helper'] = array('url'); (because you have a MY_url_helper?!

Finally: Nothing happens if i change lang=en to lang=hu. Any idea?

Thanks.

benjamincurrie commented 12 years ago

Correct with the url vs uri, I'll fix that.

Make sure 'enable_query_strings' is set to TRUE in the config.php

tragoro commented 12 years ago

10x for help. the problem was in the config file... i haven't enable hooks. i'am stuck a little bit with another problem, but maybe i'm doing something wrong again.

i' am using query strings for url as i said. so when i set ?lang=es for example the language is changing, but after browsing another page it sets the default language or the browser language. i think that the language should be stored in a session var or cookie (maybe in the hook)?!

or am i doing something wrong?