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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Help with Translatable ModelAdmin


Go to End


1322 Views

Avatar
dompie

Community Member, 88 Posts

16 September 2010 at 12:34am

Edited: 16/09/2010 12:39am

Hello,

I am trying implement TranslatableModelAdmin to work with SS 2.4.1 - anyone can help? I can't find the URL anymore, but here is a SVN Link.

The extension somehow does not create new translations.

So far I have added the following code to fix occuring errors:
1) TranslatableModelAdmin.php init function replace

Requirements::javascript('translatablemodeladmin/javascript/TranslatableModelAdmin.js');

with
$vars = array('SECURITY_ID' => Session::get('SecurityID'));
Requirements::javascript('sapphire/thirdparty/jquery-livequery/jquery.livequery.js');
Requirements::javascriptTemplate('translatablemodeladmin/javascript/TranslatableModelAdmin.js', $vars);

2) TranslatableModelAdmin.js add to line 8

if($SECURITY_ID)
	url += '&SecurityID=' + $SECURITY_ID;

After this you should be able to load and submit the created "Translations" Tab in the ModelAdmin without errors. Unfortunately it still won't create a new translation. Somehow 'createtranslation' in the TranslatableModelAdmin_RecordController is not called. Fixing this by adding in TranslatableModelAdmin_RecordController EditForm (before first if statement)

$form->setFormAction('admin/Hotels/Hotel/'.$this->currentRecord->ID.'/createtranslation');

will not help.

Somehow the function createtranslation in the RecordController must be fixed, I have tried different things, but did not succeed.

Anyone can help me on this?

Would be awesome and I could finally commit my changes to SVN.