17488 Posts in 4473 Topics by 1978 members
| Go to End | Next > | |
| Author | Topic: | 7907 Views |
-
Translatable Fatal error

9 January 2008 at 1:08am
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.
-
Re: Translatable Fatal error

21 January 2008 at 2:49pm
Just wanted to say, I have the exact same problem. Anyone has suggestions on how to solve this? Is it a Bug?
-
Re: Translatable Fatal error

26 January 2008 at 6:34pm
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.
-
Re: Translatable Fatal error

28 January 2008 at 1:55am
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.
-
Re: Translatable Fatal error

28 January 2008 at 7:50am
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.
-
Re: Translatable Fatal error

8 February 2008 at 1:51am Last edited: 8 February 2008 1:51am
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?
-
Re: Translatable Fatal error

8 February 2008 at 9:31am
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.
-
Re: Translatable Fatal error

8 February 2008 at 10:54am
that sounds very good, can't wait to see that fix working!
Thats for the great work btw.cheers
| 7907 Views | ||
| Go to Top | Next > |



