Post by Nightmare » Tue Sep 23, 2008 6:16 am

Hi,

I installed a new language in opencart, with order 1 and english 2, changed it in the admin -> setting but when I go to the admin is in english... I checked the session table and is english, I dont know why it doesnt works!!!

Any hint? fix?

I need to setup up the new language as default for the front-end and the backend.

Thanks all!

Newbie

Posts

Joined
Sat Jun 23, 2007 9:16 pm

Post by bruce » Tue Sep 23, 2008 8:10 am

In the file library\language\language.php you will find the following code...

Code: Select all

    	if (array_key_exists($this->session->get('language'), $this->languages)) {
      		$this->set($this->session->get('language'));
    	} elseif (array_key_exists($this->request->get('language', 'cookie'), $this->languages)) {
      		$this->set($this->request->get('language', 'cookie'));
    	} elseif ($browser = $this->detect()) {
	    	$this->set($browser);
	  	} else {
        	$this->set($this->config->get('config_language'));
		}
It chooses the language from the first of
  • session... the user has selected a language from the language selector
  • cookie... the user has selected a language from the language selector in a previous session
  • browser language using the detect() function in the same file as the above
  • admin setting
Since it almost never gets to the last one, it is pretty useless. To do what you want, delete or comment out the middle test or replace the above with what follows.

Code: Select all

    	if (array_key_exists($this->session->get('language'), $this->languages)) {
      		$this->set($this->session->get('language'));
    	} else {
        	$this->set($this->config->get('config_language'));
		}
For initial testing, clear all cookies etc to remove the current session.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by Nightmare » Wed Sep 24, 2008 2:43 am

Maybe I found the problem. Im Italy, with english version of windows but Opera browser is Italian.

I think thats not good solution to detect the browser language instead get language from country ( with the ip )

I fix the code, thanks.

Newbie

Posts

Joined
Sat Jun 23, 2007 9:16 pm
Who is online

Users browsing this forum: No registered users and 2 guests