Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Localized page name in "add page" dialog and dropdowns (see #7798)

  • Loading branch information...
commit 59546ccf118ba8998e312de963a38d224017398d 1 parent 6b6dfae
Ingo Schommer chillu authored
7 code/controllers/CMSMain.php
View
@@ -468,8 +468,8 @@ public function PageTypes() {
$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 @@ public function PageTypes() {
'AddAction' => $addAction,
'Description' => $description,
// TODO Sprite support
- 'IconURL' => $instance->stat('icon')
+ 'IconURL' => $instance->stat('icon'),
+ 'Title' => singleton($class)->i18n_singular_name(),
)));
}
2  code/controllers/CMSPageAddController.php
View
@@ -21,7 +21,7 @@ function AddForm() {
$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')
);
4 code/model/SiteTree.php
View
@@ -2699,7 +2699,9 @@ function providePermissions() {
* @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());
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.