Roundcube Community Forum

Release Support => Pending Issues => Topic started by: Pecisk on November 04, 2008, 04:45:17 AM

Title: How to pass language code to session variable
Post by: Pecisk on November 04, 2008, 04:45:17 AM
Hi people!

First, thanks RC devs and community for such excellent product. It's easy to install, easy to use, nice, minimal, very functional interface. It rocks.

I would like to pass language code (lv_LV, en_US, etc.) via URL (index.php?lang=xx_XX) and then put it into right session variable. However, I tested and looked trough code and still don't get how one language gets enabled. Any suggestions/hints to ease road to success? :)

Cheers,
Peteris Krisjanis.
Title: How to pass language code to session variable
Post by: rosali on November 04, 2008, 09:09:21 AM
./program/include/rcmail.php

  /**
   * Setter for system user object
   *
   * @param object rcube_user Current user instance
   */
  public function set_user($user)
  {
    if (is_object($user)) {
      $this->user = $user;
      $GLOBALS['USER'] = $this->user;
     
      // overwrite config with user preferences
      $this->config->merge((array)$this->user->get_prefs());
    }
   
    $_SESSION['language'] = $this->user->language = $this->language_prop($this->config->get('language', $_SESSION['language']));

    // set localization
    setlocale(LC_ALL, $_SESSION['language'] . '.utf8');
  }