Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Content Editor Discussions /

Forum for content editors and CMS users.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

TinyMCE language dropdown


Go to End


2 Posts   1843 Views

Avatar
Hypnus

Community Member, 11 Posts

8 December 2010 at 3:36am

Edited: 09/12/2010 11:32pm

Hello,

I'm a newbie to Silverstripe and i tried to translate my site to german but cannot get it why i do not have the german language in the language dropdown of TinyMCE.

My config file has:
-------------------------- _config.php --------------------------------------------------------
// Enable Translatable
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');

// Default locale language
Translatable::set_default_locale("en_US");

// Enable locale
i18n::enable();
// Set the default site locale
i18n::set_locale('en_US');

// Define allowed locales overriding those present in i18n::$common_locales
global $allowed_locales;
$allowed_locales = array(
'en_US' => array('English', 'English'),
'de_DE' => array('German', 'Deutsch')
);
i18n::$common_locales = $allowed_locales;
------------------------------------------------------------------------------------------------------

I've added to my Page.php in the controller init function:

if($this->dataRecord->hasExtension('Translatable')) {
i18n::set_locale($this->dataRecord->Locale);
}

I've created a page but i don't have in the language dropdown the german option, only English.
There is a dropdown combo with the languages in the sitetree panel but if i select the german language from there i have to create a new sitetree with different ID for the pages and the language selection does not work for that.

Can anyone guide me to what i am doing wrong because i could not find anything regarding this in the forum on in the docs.

Thank you in advance.

Cristian.

Avatar
Hypnus

Community Member, 11 Posts

9 December 2010 at 11:34pm

OK, found the cause of the problem.
(the previous edit was wrong so i modified it)

The TinyMCE language dropdown is no longer supported in Silverstripe 2.4.3, now you should use the "Translations tab" of the page.

My problem was that if i added a field to the Page class the translations tab disappears from the CMS.

FIXED: In my case the problem was that when i added a property to the Page class i used the disable/enable CMSFieldsExtensions when i got the parents fields and that is not correct. Do NOT use then like so:

SiteTree::disableCMSFieldsExtensions();
$fields = parent::getCMSFields();
SiteTree::enableCMSFieldsExtensions();

just simply:

$fields = parent::getCMSFields();

will do it just fine.

Thanks and sorry if i got anyone confused.