FIX namespaced _t() calls

This commit is contained in:
Franco Springveldt 2017-09-14 10:27:40 +12:00
parent 7c8866d280
commit e6cf037369
14 changed files with 61 additions and 61 deletions

View File

@ -90,7 +90,7 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
if (!$id) {
$gridField->setCustomValidationMessage(
_t(
'GridFieldAddByDBField.AddFail',
__CLASS__ . '.AddFail',
'Unable to save {class} to the database.',
'Unable to add the DataObject.',
array(
@ -103,7 +103,7 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
return Security::permissionFailure(
Controller::curr(),
_t(
'GridFieldAddByDBField.PermissionFail',
__CLASS__ . '.PermissionFail',
'You don\'t have permission to create a {class}.',
'Unable to add the DataObject.',
array(
@ -186,7 +186,7 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
$gridField,
'add',
_t(
'GridFieldAddByDBField.Add',
__CLASS__ . '.Add',
'Add {name}',
'Add button text',
['name' => $obj->i18n_singular_name()]

View File

@ -24,7 +24,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
$modifiedLabel = '';
if ($record->isModifiedOnStage) {
$modifiedLabel = '<span class="modified">' . _t('GridFieldBlogPostState.Modified') . '</span>';
$modifiedLabel = '<span class="modified">' . _t(__CLASS__ . '.Modified') . '</span>';
}
if (!$record->isPublished()) {
@ -34,7 +34,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
$lastEdited = $record->dbObject('LastEdited');
return _t(
'GridFieldBlogPostState.Draft',
__CLASS__ . '.Draft',
'<i class="btn-icon gridfield-icon btn-icon-pencil"></i> Saved as Draft on {date}',
'State for when a post is saved.',
array(
@ -50,7 +50,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
if (strtotime($record->PublishDate) > time()) {
return _t(
'GridFieldBlogPostState.Timer',
__CLASS__ . '.Timer',
'<i class="gridfield-icon blog-icon-timer"></i> Publish at {date}',
'State for when a post is published.',
array(
@ -60,7 +60,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
}
return _t(
'GridFieldBlogPostState.Published',
__CLASS__ . '.Published',
'<i class="btn-icon gridfield-icon btn-icon-accept"></i> Published on {date}',
'State for when a post is published.',
array(

View File

@ -151,7 +151,7 @@ class Blog extends Page implements PermissionProvider
$categories = GridField::create(
'Categories',
_t('Blog.Categories', 'Categories'),
_t(__CLASS__ . '.Categories', 'Categories'),
$this->Categories(),
GridFieldCategorisationConfig::create(
15,
@ -164,7 +164,7 @@ class Blog extends Page implements PermissionProvider
$tags = GridField::create(
'Tags',
_t('Blog.Tags', 'Tags'),
_t(__CLASS__ . '.Tags', 'Tags'),
$this->Tags(),
GridFieldCategorisationConfig::create(
15,
@ -282,15 +282,15 @@ class Blog extends Page implements PermissionProvider
}
if ($this->isEditor($member)) {
return _t('Blog.EDITOR', 'Editor');
return _t(__CLASS__ . '.EDITOR', 'Editor');
}
if ($this->isWriter($member)) {
return _t('Blog.WRITER', 'Writer');
return _t(__CLASS__ . '.WRITER', 'Writer');
}
if ($this->isContributor($member)) {
return _t('Blog.CONTRIBUTOR', 'Contributor');
return _t(__CLASS__ . '.CONTRIBUTOR', 'Contributor');
}
return null;
@ -349,7 +349,7 @@ class Blog extends Page implements PermissionProvider
$fields->addFieldToTab(
'Root.Settings',
NumericField::create('PostsPerPage', _t('Blog.PostsPerPage', 'Posts Per Page'))
NumericField::create('PostsPerPage', _t(__CLASS__ . '.PostsPerPage', 'Posts Per Page'))
);
$members = $this->getCandidateUsers()->map()->toArray();
@ -586,7 +586,7 @@ class Blog extends Page implements PermissionProvider
*/
public function getLumberjackTitle()
{
return _t('Blog.LumberjackTitle', 'Blog Posts');
return _t(__CLASS__ . '.LumberjackTitle', 'Blog Posts');
}
/**
@ -607,14 +607,14 @@ class Blog extends Page implements PermissionProvider
return array(
Blog::MANAGE_USERS => array(
'name' => _t(
'Blog.PERMISSION_MANAGE_USERS_DESCRIPTION',
__CLASS__ . '.PERMISSION_MANAGE_USERS_DESCRIPTION',
'Manage users for individual blogs'
),
'help' => _t(
'Blog.PERMISSION_MANAGE_USERS_HELP',
__CLASS__ . '.PERMISSION_MANAGE_USERS_HELP',
'Allow assignment of Editors, Writers, or Contributors to blogs'
),
'category' => _t('Blog.PERMISSIONS_CATEGORY', 'Blog permissions'),
'category' => _t(__CLASS__ . '.PERMISSIONS_CATEGORY', 'Blog permissions'),
'sort' => 100
)
);

View File

@ -72,6 +72,6 @@ class BlogCategory extends DataObject implements CategorisationObject
*/
protected function getDuplicateError()
{
return _t('BlogCategory.Duplicate', 'A blog category already exists with that name.');
return _t(__CLASS__ . '.Duplicate', 'A blog category already exists with that name.');
}
}

View File

@ -326,7 +326,7 @@ class BlogController extends PageController
if ($currentPage > 1) {
$items[] = _t(
'Blog.FILTERDESCRIPTION_PAGE',
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_PAGE',
'Page {page}',
null,
array(
@ -337,7 +337,7 @@ class BlogController extends PageController
if ($author = $this->getCurrentProfile()) {
$items[] = _t(
'Blog.FILTERDESCRIPTION_AUTHOR',
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_AUTHOR',
'By {author}',
null,
array(
@ -348,7 +348,7 @@ class BlogController extends PageController
if ($tag = $this->getCurrentTag()) {
$items[] = _t(
'Blog.FILTERDESCRIPTION_TAG',
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_TAG',
'Tagged with {tag}',
null,
array(
@ -359,7 +359,7 @@ class BlogController extends PageController
if ($category = $this->getCurrentCategory()) {
$items[] = _t(
'Blog.FILTERDESCRIPTION_CATEGORY',
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_CATEGORY',
'In category {category}',
null,
array(
@ -378,7 +378,7 @@ class BlogController extends PageController
}
$items[] = _t(
'Blog.FILTERDESCRIPTION_DATE',
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_DATE',
'In {date}',
null,
array(

View File

@ -111,11 +111,11 @@ class BlogMemberExtension extends DataExtension
Requirements::css(BLOGGER_DIR . '/css/cms.css');
Requirements::javascript(BLOGGER_DIR . '/js/cms.js');
$tab = Tab::create('BlogPosts', _t('BlogMemberExtension.TABBLOGPOSTS', 'Blog Posts'));
$tab = Tab::create('BlogPosts', _t(__CLASS__ . '.TABBLOGPOSTS', 'Blog Posts'));
$gridField = GridField::create(
'BlogPosts',
_t('BlogMemberExtension.BLOGPOSTS', 'Blog Posts'),
_t(__CLASS__ . '.BLOGPOSTS', 'Blog Posts'),
$this->owner->BlogPosts(),
GridFieldConfig_BlogPost::create()
);

View File

@ -35,12 +35,11 @@ trait BlogObject
*/
public function getCMSFields()
{
$shortClass = ClassInfo::shortName(self::class);
$fields = TabSet::create(
'Root',
Tab::create(
'Main',
TextField::create('Title', _t($shortClass . '.Title', 'Title'))
TextField::create('Title', _t(__CLASS__ . '.Title', 'Title'))
)
);

View File

@ -169,7 +169,7 @@ class BlogPost extends Page
}
if ($this->isAuthor($member)) {
return _t('BlogPost.AUTHOR', 'Author');
return _t(__CLASS__ . '.AUTHOR', 'Author');
}
$parent = $this->Parent();
@ -212,7 +212,7 @@ class BlogPost extends Page
Requirements::javascript(BLOGGER_DIR . '/js/cms.js');
$this->beforeUpdateCMSFields(function ($fields) {
$uploadField = UploadField::create('FeaturedImage', _t('BlogPost.FeaturedImage', 'Featured Image'));
$uploadField = UploadField::create('FeaturedImage', _t(__CLASS__ . '.FeaturedImage', 'Featured Image'));
$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
/**
@ -223,13 +223,13 @@ class BlogPost extends Page
$summary = HtmlEditorField::create('Summary', false);
$summary->setRows(5);
$summary->setDescription(_t(
'BlogPost.SUMMARY_DESCRIPTION',
__CLASS__ . '.SUMMARY_DESCRIPTION',
'If no summary is specified the first 30 words will be used.'
));
$summaryHolder = ToggleCompositeField::create(
'CustomSummary',
_t('BlogPost.CUSTOMSUMMARY', 'Add A Custom Summary'),
_t(__CLASS__ . '.CUSTOMSUMMARY', 'Add A Custom Summary'),
array(
$summary,
)
@ -249,18 +249,18 @@ class BlogPost extends Page
$authorField = ListboxField::create(
'Authors',
_t('BlogPost.Authors', 'Authors'),
_t(__CLASS__ . '.Authors', 'Authors'),
$this->getCandidateAuthors()->map()->toArray()
);
$authorNames = TextField::create(
'AuthorNames',
_t('BlogPost.AdditionalCredits', 'Additional Credits'),
_t(__CLASS__ . '.AdditionalCredits', 'Additional Credits'),
null,
1024
)->setDescription(
_t(
'BlogPost.AdditionalCredits_Description',
__CLASS__ . '.AdditionalCredits_Description',
'If some authors of this post don\'t have CMS access, enter their name(s) here. You can separate multiple names with a comma.'
)
);
@ -270,12 +270,12 @@ class BlogPost extends Page
$authorNames = $authorNames->performDisabledTransformation();
}
$publishDate = DatetimeField::create('PublishDate', _t('BlogPost.PublishDate', 'Publish Date'));
$publishDate = DatetimeField::create('PublishDate', _t(__CLASS__ . '.PublishDate', 'Publish Date'));
if (!$this->PublishDate) {
$publishDate->setDescription(
_t(
'BlogPost.PublishDate_Description',
__CLASS__ . '.PublishDate_Description',
'Will be set to "now" if published without a value.'
)
);
@ -299,7 +299,7 @@ class BlogPost extends Page
$urlSegment,
TagField::create(
'Categories',
_t('BlogPost.Categories', 'Categories'),
_t(__CLASS__ . '.Categories', 'Categories'),
$categories,
$this->Categories()
)
@ -307,7 +307,7 @@ class BlogPost extends Page
->setShouldLazyLoad(true),
TagField::create(
'Tags',
_t('BlogPost.Tags', 'Tags'),
_t(__CLASS__ . '.Tags', 'Tags'),
$tags,
$this->Tags()
)
@ -721,7 +721,7 @@ class BlogPost extends Page
{
$labels = parent::fieldLabels($includeRelations);
$labels['Title'] = _t('BlogPost.PageTitleLabel', 'Post Title');
$labels['Title'] = _t(__CLASS__ . '.PageTitleLabel', 'Post Title');
return $labels;
}

View File

@ -72,6 +72,6 @@ class BlogTag extends DataObject implements CategorisationObject
*/
protected function getDuplicateError()
{
return _t('BlogTag.Duplicate', 'A blog tag already exists with that name.');
return _t(__CLASS__ . '.Duplicate', 'A blog tag already exists with that name.');
}
}

View File

@ -71,7 +71,7 @@ class BlogArchiveWidget extends Widget
$type = $archiveType->enumValues();
foreach ($type as $k => $v) {
$type[$k] = _t('BlogArchiveWidget.' . ucfirst(strtolower($v)), $v);
$type[$k] = _t(__CLASS__ .'.' . ucfirst(strtolower($v)), $v);
}
/**
@ -80,11 +80,11 @@ class BlogArchiveWidget extends Widget
$fields->merge(array(
DropdownField::create(
'BlogID',
_t('BlogArchiveWidget.Blog', 'Blog'),
_t(__CLASS__ . '.Blog', 'Blog'),
Blog::get()->map()
),
DropdownField::create('ArchiveType', _t('BlogArchiveWidget.ArchiveType', 'ArchiveType'), $type),
NumericField::create('NumberToDisplay', _t('BlogArchiveWidget.NumberToDisplay', 'No. to Display'))
DropdownField::create('ArchiveType', _t(__CLASS__ . '.ArchiveType', 'ArchiveType'), $type),
NumericField::create('NumberToDisplay', _t(__CLASS__ . '.NumberToDisplay', 'No. to Display'))
));
});

View File

@ -11,6 +11,7 @@ use SilverStripe\Core\Convert;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\NumericField;
use SilverStripe\ORM\DataList;
use SilverStripe\Widgets\Model\Widget;
/**
@ -57,18 +58,18 @@ class BlogCategoriesWidget extends Widget
$this->beforeUpdateCMSFields(function (FieldList $fields) {
$fields[] = DropdownField::create(
'BlogID',
_t('BlogCategoriesWidget.Blog', 'Blog'),
_t(__CLASS__ . '.Blog', 'Blog'),
Blog::get()->map()
);
$fields[] = NumericField::create(
'Limit',
_t('BlogCategoriesWidget.Limit', 'Limit'),
_t(__CLASS__ . '.Limit', 'Limit'),
0
)
->setDescription(
_t(
'BlogCategoriesWidget.Limit_Description',
__CLASS__ . '.Limit_Description',
'Limit the number of categories shown by this widget (set to 0 to show all categories).'
)
)
@ -76,21 +77,21 @@ class BlogCategoriesWidget extends Widget
$fields[] = DropdownField::create(
'Order',
_t('BlogCategoriesWidget.Sort', 'Sort'),
_t(__CLASS__ . '.Sort', 'Sort'),
array('Title' => 'Title', 'Created' => 'Created', 'LastEdited' => 'Updated')
)
->setDescription(
_t('BlogCategoriesWidget.Sort_Description', 'Change the order of categories shown by this widget.')
_t(__CLASS__ . '.Sort_Description', 'Change the order of categories shown by this widget.')
);
$fields[] = DropdownField::create(
'Direction',
_t('BlogCategoriesWidget.Direction', 'Direction'),
_t(__CLASS__ . '.Direction', 'Direction'),
array('ASC' => 'Ascending', 'DESC' => 'Descending')
)
->setDescription(
_t(
'BlogCategoriesWidget.Direction_Description',
__CLASS__ . '.Direction_Description',
'Change the direction of ordering of categories shown by this widget.'
)
);

View File

@ -57,8 +57,8 @@ class BlogRecentPostsWidget extends Widget
* @var FieldList $fields
*/
$fields->merge(array(
DropdownField::create('BlogID', _t('BlogRecentPostsWidget.Blog', 'Blog'), Blog::get()->map()),
NumericField::create('NumberOfPosts', _t('BlogRecentPostsWidget.NumberOfPosts', 'Number of Posts'))
DropdownField::create('BlogID', _t(__CLASS__ . '.Blog', 'Blog'), Blog::get()->map()),
NumericField::create('NumberOfPosts', _t(__CLASS__ . '.NumberOfPosts', 'Number of Posts'))
));
});

View File

@ -58,7 +58,7 @@ class BlogTagsCloudWidget extends Widget
$fields->push(
DropdownField::create(
'BlogID',
_t('BlogTagsCloudWidget.Blog', 'Blog'),
_t(__CLASS__ . '.Blog', 'Blog'),
Blog::get()->map()
)
);

View File

@ -57,18 +57,18 @@ class BlogTagsWidget extends Widget
$this->beforeUpdateCMSFields(function (Fieldlist $fields) {
$fields[] = DropdownField::create(
'BlogID',
_t('BlogTagsWidget.Blog', 'Blog'),
_t(__CLASS__ . '.Blog', 'Blog'),
Blog::get()->map()
);
$fields[] = NumericField::create(
'Limit',
_t('BlogTagsWidget.Limit', 'Limit'),
_t(__CLASS__ . '.Limit', 'Limit'),
0
)
->setDescription(
_t(
'BlogTagsWidget.Limit_Description',
__CLASS__ . '.Limit_Description',
'Limit the number of tags shown by this widget (set to 0 to show all tags).'
)
)
@ -76,21 +76,21 @@ class BlogTagsWidget extends Widget
$fields[] = DropdownField::create(
'Order',
_t('BlogTagsWidget.Sort', 'Sort'),
_t(__CLASS__ . '.Sort', 'Sort'),
array('Title' => 'Title', 'Created' => 'Created', 'LastEdited' => 'Updated')
)
->setDescription(
_t('BlogTagsWidget.Sort_Description', 'Change the order of tags shown by this widget.')
_t(__CLASS__ . '.Sort_Description', 'Change the order of tags shown by this widget.')
);
$fields[] = DropdownField::create(
'Direction',
_t('BlogTagsWidget.Direction', 'Direction'),
_t(__CLASS__ . '.Direction', 'Direction'),
array('ASC' => 'Ascending', 'DESC' => 'Descending')
)
->setDescription(
_t(
'BlogTagsWidget.Direction_Description',
__CLASS__ . '.Direction_Description',
'Change the direction of ordering of tags shown by this widget.'
)
);