Jump to:

513 Posts in 209 Topics by 259 members

Content Editor Discussions

SilverStripe Forums » Content Editor Discussions » TinyMCE language dropdown

Forum for content editors and CMS users.

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

Page: 1
Go to End
Author Topic: 962 Views
  • Hypnus
    Avatar
    Community Member
    11 Posts

    TinyMCE language dropdown Link to this post

    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.

  • Hypnus
    Avatar
    Community Member
    11 Posts

    Re: TinyMCE language dropdown Link to this post

    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.

    962 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.