Roundcube Community Forum

 

How to pass language code to session variable

Started by Pecisk, November 04, 2008, 04:45:17 AM

Previous topic - Next topic

Pecisk

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.

rosali

./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');
  }
Regards,
Rosali