public function setLanguage($value)
{
// get the possible languages
$possibleLanguages = BackendLanguage::getWorkingLanguages();
// validate
if (!array_key_exists($value, $possibleLanguages)) {
throw new Exception('Invalid language.');
}
// set property
$this->language = $value;
// set the locale (we need this for the labels)
BackendLanguage::setLocale($this->language);
// set working language
BackendLanguage::setWorkingLanguage($this->language);
}