You are here

public function Messaging_User_Object::set_language in Messaging 6.4

Set language object / property

2 calls to Messaging_User_Object::set_language()
Messaging_User_Object::get_language in includes/messaging_object.class.inc
Get language object
Messaging_User_Object::__construct in includes/messaging_object.class.inc
Constructor, with predefined array of data

File

includes/messaging_object.class.inc, line 118
Drupal Messaging Framework - Base classes

Class

Messaging_User_Object
Messaging user's object

Code

public function set_language($language = NULL) {
  if ($language) {
    $this->language = $language->language;
    $this->_language = $language;
  }
  elseif (!empty($this->language) && ($languages = language_list()) && isset($languages[$this->language])) {
    $this->_language = $languages[$this->language];
  }
  elseif ($account = $this
    ->get_user()) {

    // Fallback to account language
    return $this
      ->set_language(user_preferred_language($account));
  }
  else {

    // Fallback to default language
    return $this
      ->set_language(language_default());
  }
}