diff --git a/code/CMSMain.php b/code/CMSMain.php index 3fb695f5..4a0ee603 100644 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -87,31 +87,22 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr // Locale" attribute is either explicitly added by LeftAndMain Javascript logic, // or implied on a translated record (see {@link Translatable->updateCMSFields()}). - 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"); - } else { - $this->Locale = Translatable::default_locale(); - } - Translatable::set_current_locale($this->Locale); - } - - // collect languages for TinyMCE spellchecker plugin - if(Translatable::is_enabled()) { - $spellcheckLangs = Translatable::get_existing_content_languages(); + // $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"); } else { - $defaultLang = Translatable::default_locale(); - $spellcheckLangs = array($defaultLang => i18n::get_locale_name($defaultLang)); + $this->Locale = Translatable::default_locale(); } - $spellcheckSpec = array(); - foreach($spellcheckLangs as $lang => $title) $spellcheckSpec[] = "{$title}={$lang}"; - - // Set custom options for TinyMCE specific to CMSMain - HtmlEditorConfig::get('cms')->setOption('spellchecker_languages', '+' . implode(',', $spellcheckSpec)); + Translatable::set_current_locale($this->Locale); + + // collect languages for TinyMCE spellchecker plugin. + // see http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker + $lang = i18n::get_lang_from_locale($this->Locale); + $langName = i18n::get_locale_name($this->Locale); + HtmlEditorConfig::get('cms')->setOption('spellchecker_languages', "+{$langName}={$lang}"); Requirements::javascript(CMS_DIR . '/javascript/CMSMain.js'); Requirements::javascript(CMS_DIR . '/javascript/CMSMain_left.js');