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();
|
$addAction = $instance->i18n_singular_name();
|
||||||
|
|
||||||
// Get description
|
// Get description (convert 'Page' to 'SiteTree' for correct localization lookups)
|
||||||
$description = _t($class . '.DESCRIPTION');
|
$description = _t((($class == 'Page') ? 'SiteTree' : $class) . '.DESCRIPTION');
|
||||||
|
|
||||||
if(!$description) {
|
if(!$description) {
|
||||||
$description = $instance->uninherited('description');
|
$description = $instance->uninherited('description');
|
||||||
@ -484,7 +484,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
'AddAction' => $addAction,
|
'AddAction' => $addAction,
|
||||||
'Description' => $description,
|
'Description' => $description,
|
||||||
// TODO Sprite support
|
// 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();
|
$pageTypes = array();
|
||||||
foreach($this->PageTypes() as $type) {
|
foreach($this->PageTypes() as $type) {
|
||||||
$html = sprintf('<span class="page-icon class-%s"></span><strong class="title">%s</strong><span class="description">%s</span>',
|
$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('AddAction'),
|
||||||
$type->getField('Description')
|
$type->getField('Description')
|
||||||
);
|
);
|
||||||
|
@ -2699,7 +2699,9 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function i18n_singular_name() {
|
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