mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Localized page name in "add page" dialog and dropdowns (see #7798)
This commit is contained in:
parent
6b6dfaed7b
commit
59546ccf11
@ -468,8 +468,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
|
||||
$addAction = $instance->i18n_singular_name();
|
||||
|
||||
// Get description
|
||||
$description = _t($class . '.DESCRIPTION');
|
||||
// Get description (convert 'Page' to 'SiteTree' for correct localization lookups)
|
||||
$description = _t((($class == 'Page') ? 'SiteTree' : $class) . '.DESCRIPTION');
|
||||
|
||||
if(!$description) {
|
||||
$description = $instance->uninherited('description');
|
||||
@ -484,7 +484,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
'AddAction' => $addAction,
|
||||
'Description' => $description,
|
||||
// TODO Sprite support
|
||||
'IconURL' => $instance->stat('icon')
|
||||
'IconURL' => $instance->stat('icon'),
|
||||
'Title' => singleton($class)->i18n_singular_name(),
|
||||
)));
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ class CMSPageAddController extends CMSPageEditController {
|
||||
$pageTypes = array();
|
||||
foreach($this->PageTypes() as $type) {
|
||||
$html = sprintf('<span class="page-icon class-%s"></span><strong class="title">%s</strong><span class="description">%s</span>',
|
||||
$type->getField('ClassName'),
|
||||
$type->getField('Title'),
|
||||
$type->getField('AddAction'),
|
||||
$type->getField('Description')
|
||||
);
|
||||
|
@ -2699,7 +2699,9 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
||||
* @return String
|
||||
*/
|
||||
function i18n_singular_name() {
|
||||
return _t($this->class.'.SINGULARNAME', $this->singular_name());
|
||||
// Convert 'Page' to 'SiteTree' for correct localization lookups
|
||||
$class = ($this->class == 'Page') ? 'SiteTree' : $this->class;
|
||||
return _t($class.'.SINGULARNAME', $this->singular_name());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user