Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Translatable Fatal error

Our old forums are still available as a read-only archive.

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

Page: 1 2 3
Go to End
Author Topic: 8704 Views
  • hitautodestruct
    Avatar
    Community Member
    19 Posts

    Translatable Fatal error Link to this post

    Hey there anyone that can help.

    I have managed to get my site up and running with custom fields and templates.
    So now the only thing thats stopping me from implementing my Silverstripe site and the main reason for choosing this framework is the Translatable option.

    It seems that every time I enable the:

    static $extensions = array("Translatable('CustomField')");


    For one or many of my custom fields I get a dramatic Fatal Error.

    I have tried everything to no avail.
    Can anyone help me with this?

    SilverStripe ver. 2.2.1
    Apache, MySQL and PHP5
    Are all according to stats.

    This is the code for my HomePage.php Pagetype:

    <?php
    class HomePage extends SiteTree {
       static $db = array(
          'Slogan' => 'Varchar'
       );

    //This is the code I insert that causes all the problems
       static $extensions = array(
          "Translatable('Slogan')"
       );

    static $has_one = array(
    );

       static $defaults = array(
       );

          function getCMSFields() {
             $fields = parent::getCMSFields();

             $fields->addFieldToTab('Root.Content.Main', new TextField('Slogan', 'The slogan text under the rummy royal logo:'), 'Content');

        return $fields;
       }
    }

    class HomePage_Controller extends ContentController {
       function init() {
          parent::init();
          Requirements::themedCSS("RummyStyle");
       }
    }
    ?>

    I attached the error page to this post as well.

  • yitter
    Avatar
    Community Member
    10 Posts

    Re: Translatable Fatal error Link to this post

    Just wanted to say, I have the exact same problem. Anyone has suggestions on how to solve this? Is it a Bug?

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Translatable Fatal error Link to this post

    hm this might be a bug in the translation system - can you try re-setting all $extensions in your subclass? see sapphire/core/model/SiteTree.php $extensions array.

  • hitautodestruct
    Avatar
    Community Member
    19 Posts

    Re: Translatable Fatal error Link to this post

    Hey Ingo
    Thanks for the reply but I have gone about a different way of setting up translating my site.
    I now have a duplicated HomePage and Page page types with a different language prefix for each language.
    Example:
    german is de-home,
    spanish is: es-home etc.

    This is also more SEO compatible since the search engine does not recognize the ?lang= attribute and can't index the other language pages.

    I have messed around way to much with the translation system and all it did was cause me trouble. So, I'm not going to test out anything else.

    But on the plus side I'm still using SS for the purpose I initially intended it for, which is a multi-language site.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Translatable Fatal error Link to this post

    fair enough, thanks for your patience. we're just bulding our first commercial applications with the translation system as well (it was built by a google summer of code student), so its still a fairly young component of Silverstripe.

  • yitter
    Avatar
    Community Member
    10 Posts

    Re: Translatable Fatal error Link to this post

    well messing with the translation system also got me into trouble. You mentioned to re-set all extensions in the Page class, I did it like that:

    class Page extends SiteTree {
    ...
    /* this is just copied from SiteTree*/
    static $extensions = array(
          "Hierarchy",
          "Translatable('Title', 'MenuTitle', 'Content', 'URLSegment', 'MetaTitle', 'MetaDescription', 'MetaKeywords', 'Status', 'ExtraMeta')",
          "Versioned('Stage', 'Live')"   
       );
    ...
    }

    I'm not sure if this is a real re-set but the problem is still the same: Adding Custom Fields to the Translateable causes serious errors. But when doing the same in the Site Tree Class (new Custom field etc.) I can add it to the $extensions Translateable array .... Strange enough?!

    But if I now try to Translate a Page only the original Site Tree Fields can be translated, the new Field is only viewable (not editable) and I can't find any reason why that is. It is strange ...

    Any suggestions?

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Translatable Fatal error Link to this post

    we've got a fix in one of our project branches, which matt will merge back to trunk soon (~ 2 weeks). basically we're defining translatable-fields on a new static in the SiteTree class instead, and have cleaned up the DataObjectDecorator logic a bit.

  • yitter
    Avatar
    Community Member
    10 Posts

    Re: Translatable Fatal error Link to this post

    that sounds very good, can't wait to see that fix working!
    Thats for the great work btw.

    cheers

    8704 Views
Page: 1 2 3
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.