- <?php
- public function init() {
- parent::init();
- // Locale" attribute is either explicitly added by LeftAndMain Javascript logic,
- // or implied on a translated record (see {@link Translatable->updateCMSFields()}).
- // $Lang serves as a "context" which can be inspected by Translatable - hence it
- // has the same name as the database property on Translatable.
- // EDIT BY DANZZZ
- if(Translatable::is_enabled()) {
- // $Lang serves as a "context" which can be inspected by Translatable - hence it
- // has the same name as the database property on Translatable.
- if($this->getRequest()->requestVar("Locale")) {
- $this->Locale = $this->getRequest()->requestVar("Locale");
- } elseif($this->getRequest()->requestVar("locale")) {
- $this->Locale = $this->getRequest()->requestVar("locale");
- } elseif (Session::get("{$this->class}.Locale")) {
- $this->Locale = Session::get("{$this->class}.Locale");
- } else {
- $this->Locale = Translatable::default_locale();
- }
- Translatable::set_current_locale($this->Locale);
- Session::set("{$this->class}.Locale", $this->Locale);
- }
- /*
- if($this->getRequest()->requestVar("Locale")) {
- $this->Locale = $this->getRequest()->requestVar("Locale");
- } elseif($this->getRequest()->requestVar("locale")) {
- $this->Locale = $this->getRequest()->requestVar("locale");
- } else {
- $this->Locale = Translatable::default_locale();
- }
- Translatable::set_current_locale($this->Locale);
- */
- // collect languages for TinyMCE spellchecker plugin.
- // see http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
- $langName = i18n::get_locale_name($this->Locale);
- HtmlEditorConfig::get('cms')->setOption('spellchecker_languages', "+{$langName}={$this->Locale}");
- Requirements::javascript(CMS_DIR . '/javascript/CMSMain.js');
- Requirements::javascript(CMS_DIR . '/javascript/CMSMain_left.js');
- Requirements::javascript(CMS_DIR . '/javascript/CMSMain_right.js');
- }
- ?>