Skip to content

Commit

Permalink
Merge pull request #511 from dhensby/pull/502
Browse files Browse the repository at this point in the history
Make Categorization and PostOptions localizable
  • Loading branch information
dhensby authored Feb 20, 2018
2 parents 5c1cede + 519fe25 commit 9cc98c3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
7 changes: 7 additions & 0 deletions lang/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ en:
UsersEditorsFieldDescription: "An editor has control over specific Blogs, and all posts included within it. \n Short of being able to assign other editors to a blog, they are able to handle most changes to\n their assigned blog. <br /><br />\n Editors have these permissions:<br />\n <br />\n Update or publish any BlogPost in their Blog<br />\n Update or publish their Blog<br />\n Assign/unassign writers to their Blog<br />\n Assign/unassign contributors to their Blog<br />\n Assign/unassign any member as an author of a particular BlogPost"
UsersWritersFieldDescription: "A writer has full control over creating, editing and publishing BlogPosts they have authored\n or have been assigned to. Writers are unable to edit BlogPosts to which they are not assigned.\n <br /><br />\n Writers have these permissions:<br />\n <br />\n Update or publish any BlogPost they have authored or have been assigned to<br />\n Assign/unassign any member as an author of a particular BlogPost they have authored or have been \n assigned to"
WRITER: Writer
Categorisation: 'Categorisation'
SilverStripe\Blog\Model\BlogCategory:
Duplicate: 'A blog category already exists with that name.'
PLURALNAME: 'Blog Categories'
Expand Down Expand Up @@ -74,6 +75,7 @@ en:
SINGULARNAME: 'Blog Post'
SUMMARY_DESCRIPTION: 'If no summary is specified the first 30 words will be used.'
Tags: Tags
PostOptions: 'Post Options'
SilverStripe\Blog\Model\BlogTag:
Duplicate: 'A blog tag already exists with that name.'
PLURALNAME: 'Blog Tags'
Expand Down Expand Up @@ -131,3 +133,8 @@ en:
SINGULARNAME: 'Blog Tags Widget'
Sort: Sort
Sort_Description: 'Change the order of tags shown by this widget.'
SilverStripe\Blog\Admin\GridFieldMergeAction:
MovePostsTo: 'Move posts to'
SilverStripe\Blog\Admin\GridFieldCategorisationConfig:
Title: Title
Posts: Posts
4 changes: 2 additions & 2 deletions src/Admin/GridFieldCategorisationConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ protected function changeColumnOrder()

$columns->setDisplayFields(
[
'Title' => 'Title',
'BlogPostsCount' => 'Posts',
'Title' => _t(__CLASS__ . '.Title', 'Title'),
'BlogPostsCount' => _t(__CLASS__ . '.Posts', 'Posts'),
'MergeAction' => 'MergeAction',
'Actions' => 'Actions'
]
Expand Down
7 changes: 4 additions & 3 deletions src/Admin/GridFieldMergeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ public function getColumnContent($gridField, $record, $columnName)
]);

$action->addExtraClass('btn btn-primary btn-sm blog-merge-action');
$MovePostsTo = _t(__CLASS__ . '.MovePostsTo', 'Move posts to');
$MergeActionReveal = '<a title="' . $MovePostsTo . '" class="MergeActionReveal">' . $MovePostsTo . '</a>';

return $dropdown->Field() . $action->Field() .
'<a title="Move posts to" class="MergeActionReveal">Move posts to</a>';
return $dropdown->Field() . $action->Field() . $MergeActionReveal;
}

return null;
Expand All @@ -123,7 +124,7 @@ public function getColumnAttributes($gridField, $record, $columnName)
*/
public function getColumnMetadata($gridField, $columnName)
{
return ['title' => 'Move posts to'];
return ['title' => _t(__CLASS__ . '.MovePostsTo', 'Move posts to')];
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Model/Blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ public function getCMSFields()
]
);

$fields->findOrMakeTab('Root.Categorisation')->addExtraClass('blog-cms-categorisation');
$fields->fieldByName('Root.Categorisation')
->addExtraClass('blog-cms-categorisation')
->setTitle(_t(__CLASS__ . '.Categorisation', 'Categorisation'));
});

return parent::getCMSFields();
Expand Down
3 changes: 3 additions & 0 deletions src/Model/BlogPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ public function getCMSFields()

$fields->fieldByName('Root')->setTemplate('TabSet_holder');

$fields->fieldByName('Root.PostOptions')
->setTitle(_t(__CLASS__ . '.PostOptions', 'Post Options'));

return $fields;
}

Expand Down

0 comments on commit 9cc98c3

Please sign in to comment.