mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUGFIX Setting lang-code instead of locale in CMSMain->init() for TinyMCE spell checking
BUGFIX Always choosing translatable default language in CMSMain->init() for TinyMCE spell checking. Always setting $CMSMain->Locale in order to have it available for the spell checking git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@81716 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ac589ba236
commit
eebaebca0e
@ -87,31 +87,22 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
// Locale" attribute is either explicitly added by LeftAndMain Javascript logic,
|
// Locale" attribute is either explicitly added by LeftAndMain Javascript logic,
|
||||||
// or implied on a translated record (see {@link Translatable->updateCMSFields()}).
|
// 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
|
||||||
// $Lang serves as a "context" which can be inspected by Translatable - hence it
|
// has the same name as the database property on Translatable.
|
||||||
// has the same name as the database property on Translatable.
|
if($this->getRequest()->requestVar("Locale")) {
|
||||||
if($this->getRequest()->requestVar("Locale")) {
|
$this->Locale = $this->getRequest()->requestVar("Locale");
|
||||||
$this->Locale = $this->getRequest()->requestVar("Locale");
|
} elseif($this->getRequest()->requestVar("locale")) {
|
||||||
} elseif($this->getRequest()->requestVar("locale")) {
|
$this->Locale = $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();
|
|
||||||
} else {
|
} else {
|
||||||
$defaultLang = Translatable::default_locale();
|
$this->Locale = Translatable::default_locale();
|
||||||
$spellcheckLangs = array($defaultLang => i18n::get_locale_name($defaultLang));
|
|
||||||
}
|
}
|
||||||
$spellcheckSpec = array();
|
Translatable::set_current_locale($this->Locale);
|
||||||
foreach($spellcheckLangs as $lang => $title) $spellcheckSpec[] = "{$title}={$lang}";
|
|
||||||
|
// collect languages for TinyMCE spellchecker plugin.
|
||||||
// Set custom options for TinyMCE specific to CMSMain
|
// see http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
|
||||||
HtmlEditorConfig::get('cms')->setOption('spellchecker_languages', '+' . implode(',', $spellcheckSpec));
|
$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.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/CMSMain_left.js');
|
Requirements::javascript(CMS_DIR . '/javascript/CMSMain_left.js');
|
||||||
|
Loading…
Reference in New Issue
Block a user