Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 4th, 2012  |  syntax: None  |  size: 2.01 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. public function init() {
  4.                 parent::init();
  5.                
  6.                 // Locale" attribute is either explicitly added by LeftAndMain Javascript logic,
  7.                 // or implied on a translated record (see {@link Translatable->updateCMSFields()}).
  8.                 // $Lang serves as a "context" which can be inspected by Translatable - hence it
  9.                 // has the same name as the database property on Translatable.
  10.                
  11.                 // EDIT BY DANZZZ
  12.                
  13.                         if(Translatable::is_enabled()) {
  14.                    // $Lang serves as a "context" which can be inspected by Translatable - hence it
  15.                    // has the same name as the database property on Translatable.
  16.                    if($this->getRequest()->requestVar("Locale")) {
  17.                       $this->Locale = $this->getRequest()->requestVar("Locale");
  18.                    } elseif($this->getRequest()->requestVar("locale")) {
  19.                       $this->Locale = $this->getRequest()->requestVar("locale");
  20.                     } elseif (Session::get("{$this->class}.Locale")) {
  21.                       $this->Locale = Session::get("{$this->class}.Locale");    
  22.                    } else {
  23.                       $this->Locale = Translatable::default_locale();
  24.                    }
  25.                    Translatable::set_current_locale($this->Locale);
  26.                    Session::set("{$this->class}.Locale", $this->Locale);
  27.                 }
  28.                
  29.                 /*
  30.                 if($this->getRequest()->requestVar("Locale")) {
  31.                         $this->Locale = $this->getRequest()->requestVar("Locale");
  32.                 } elseif($this->getRequest()->requestVar("locale")) {
  33.                         $this->Locale = $this->getRequest()->requestVar("locale");
  34.                 } else {
  35.                         $this->Locale = Translatable::default_locale();
  36.                 }
  37.                 Translatable::set_current_locale($this->Locale);
  38.                 */
  39.                
  40.                 // collect languages for TinyMCE spellchecker plugin.
  41.                 // see http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
  42.                 $langName = i18n::get_locale_name($this->Locale);
  43.                 HtmlEditorConfig::get('cms')->setOption('spellchecker_languages', "+{$langName}={$this->Locale}");
  44.                                
  45.                 Requirements::javascript(CMS_DIR . '/javascript/CMSMain.js');
  46.                 Requirements::javascript(CMS_DIR . '/javascript/CMSMain_left.js');
  47.                 Requirements::javascript(CMS_DIR . '/javascript/CMSMain_right.js');
  48.         }
  49.  
  50.  
  51.  
  52. ?>