Post by sturman » Sun Mar 08, 2009 9:19 am

In the front end all you need to do to change the language is click on the flag of your choice in the upper right. In the admin there does not seem to be a setting to set or change the current language. It seems one can't set or change the current admin language by setting the default language. Rather, the admin language is apparently determined by the last language set in the front end, and apparently this is stored in a cookie.

So if one has two browser windows open, one with the front end and one with the admin, and say both are currently set to english. Then if one changes the language to, say, French in the front end, then goes to the admin and selects another menu item, then suddenly you will see the admin language has also switched to French. I don not think this is desirable. One should be able to set both languages independently. Preferably the admin lang. can be changed with a dropdown as on the front end.

But in the mean time, I have created a simple modification so that you can hard set the admin to the language of your choice. Say, you want to set the admin language to French (fr), then make the following 3 changes:

1.In config.php add this line at the end:
define('FORCE_LANGUAGE', FALSE);

2.In admin/config.php add these lines at the end:
define('FORCE_LANGUAGE', TRUE);
define('SET_LANGUAGE', 'fr');

3.In system/library/language.php change lines 27-35 from:

Code: Select all

if (array_key_exists(@$this->session->data['language'], $this->languages)) {
      	$this->set($this->session->data['language']);
} elseif (array_key_exists(@$this->request->cookie['language'], $this->languages)) {
      	$this->set($this->request->cookie['language']);
} elseif ($browser = $this->detect()) {
	    $this->set($browser);
} else {
        $this->set($this->config->get('config_language'));
}
to:

Code: Select all

if (FORCE_LANGUAGE) {
      	$this->session->data['language']=SET_LANGUAGE;
      	$this->set($this->session->data['language']);
}
else {
      	if (array_key_exists(@$this->session->data['language'], $this->languages)) {
      	      	$this->set($this->session->data['language']);
      	} elseif (array_key_exists(@$this->request->cookie['language'], $this->languages)) {
      	      	$this->set($this->request->cookie['language']);
      	} elseif ($browser = $this->detect()) {
      	      	$this->set($browser);
      	} else {
      	      	$this->set($this->config->get('config_language'));
      	}
}
A small bug is that if, say your front end is set to English, then you do something in the admin which is set to French. Then if you go back to the front end you will notice suddenly the language is also set to French, so you have to click on the English flag again to correct. Presumably this behaviour is due to a cookie or so in which the last used language is set.

Newbie

Posts

Joined
Wed Feb 25, 2009 2:09 pm

Who is online

Users browsing this forum: No registered users and 6 guests