Merge pull request #185 from janneklouman/master

Extended translation support
This commit is contained in:
Daniel Hensby 2016-07-05 11:18:43 +01:00 committed by GitHub
commit 3541dd6002
4 changed files with 15 additions and 8 deletions

View File

@ -53,7 +53,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
$field .= GridField_FormAction::create( $field .= GridField_FormAction::create(
$gridField, $gridField,
'CustomAction' . $record->ID . 'Spam', 'CustomAction' . $record->ID . 'Spam',
'Spam', _t('CommentsGridFieldAction.SPAM', 'Spam'),
'spam', 'spam',
array('RecordID' => $record->ID) array('RecordID' => $record->ID)
)->Field(); )->Field();
@ -63,7 +63,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
$field .= GridField_FormAction::create( $field .= GridField_FormAction::create(
$gridField, $gridField,
'CustomAction' . $record->ID . 'Approve', 'CustomAction' . $record->ID . 'Approve',
'Approve', _t('CommentsGridFieldAction.APPROVE', 'Approve'),
'approve', 'approve',
array('RecordID' => $record->ID) array('RecordID' => $record->ID)
)->Field(); )->Field();
@ -92,7 +92,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
// output a success message to the user // output a success message to the user
Controller::curr()->getResponse()->setStatusCode( Controller::curr()->getResponse()->setStatusCode(
200, 200,
'Comment marked as spam.' _t('CommentsGridFieldAction.COMMENTMARKEDSPAM', 'Comment marked as spam.')
); );
} }
@ -103,7 +103,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
// output a success message to the user // output a success message to the user
Controller::curr()->getResponse()->setStatusCode( Controller::curr()->getResponse()->setStatusCode(
200, 200,
'Comment approved.' _t('CommentsGridFieldAction.COMMENTAPPROVED', 'Comment approved.')
); );
} }
} }

View File

@ -26,7 +26,9 @@ class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor
$manager = new GridFieldBulkManager(); $manager = new GridFieldBulkManager();
$manager->addBulkAction( $manager->addBulkAction(
'spam', 'Spam', 'CommentsGridFieldBulkAction_Handlers', 'spam',
_t('CommentsGridFieldConfig.SPAM', 'Spam'),
'CommentsGridFieldBulkAction_Handlers',
array( array(
'isAjax' => true, 'isAjax' => true,
'icon' => 'cross', 'icon' => 'cross',
@ -35,7 +37,9 @@ class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor
); );
$manager->addBulkAction( $manager->addBulkAction(
'approve', 'Approve', 'CommentsGridFieldBulkAction_Handlers', 'approve',
_t('CommentsGridFieldConfig.APPROVE', 'Approve'),
'CommentsGridFieldBulkAction_Handlers',
array( array(
'isAjax' => true, 'isAjax' => true,
'icon' => 'cross', 'icon' => 'cross',

View File

@ -576,7 +576,7 @@ class Comment extends DataObject
->obj('Created') ->obj('Created')
->scaffoldFormField($this->fieldLabel('Created')) ->scaffoldFormField($this->fieldLabel('Created'))
->performReadonlyTransformation(), ->performReadonlyTransformation(),
TextField::create('Name', $this->fieldLabel('AuthorName')), TextField::create('Name', $this->fieldLabel('Name')),
$commentField::create('Comment', $this->fieldLabel('Comment')), $commentField::create('Comment', $this->fieldLabel('Comment')),
EmailField::create('Email', $this->fieldLabel('Email')), EmailField::create('Email', $this->fieldLabel('Email')),
TextField::create('URL', $this->fieldLabel('URL')), TextField::create('URL', $this->fieldLabel('URL')),
@ -584,7 +584,7 @@ class Comment extends DataObject
CheckboxField::create('Moderated', $this->fieldLabel('Moderated')), CheckboxField::create('Moderated', $this->fieldLabel('Moderated')),
CheckboxField::create('IsSpam', $this->fieldLabel('IsSpam')), CheckboxField::create('IsSpam', $this->fieldLabel('IsSpam')),
)) ))
->setTitle('Options') ->setTitle(_t('Comment.OPTIONS', 'Options'))
->setDescription(_t( ->setDescription(_t(
'Comment.OPTION_DESCRIPTION', 'Comment.OPTION_DESCRIPTION',
'Unmoderated and spam comments will not be displayed until approved' 'Unmoderated and spam comments will not be displayed until approved'

View File

@ -2,6 +2,9 @@
class CommentAdminTest extends SapphireTest class CommentAdminTest extends SapphireTest
{ {
protected $usesDatabase = true;
public function testProvidePermissions() public function testProvidePermissions()
{ {
$commentAdmin = new CommentAdmin(); $commentAdmin = new CommentAdmin();