diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index c215c299..e71e6498 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -206,7 +206,7 @@ JS '%s', _t('AssetAdmin.FILESYSTEMSYNCTITLE', 'Update the CMS database entries of files on the filesystem. Useful when new files have been uploaded outside of the CMS, e.g. through FTP.'), $this->Link('doSync'), - _t('FILESYSTEMSYNC','Sync files') + _t('AssetAdmin.FILESYSTEMSYNC','Sync files') ) ); } else { diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 45cfcdb7..8672db4b 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -202,9 +202,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $link; } - function LinkPageAdd() { + function LinkPageAdd($extraArguments = null) { $link = singleton("CMSPageAddController")->Link(); $this->extend('updateLinkPageAdd', $link); + if($extraArguments) $link = Controller::join_links ($link, $extraArguments); return $link; } @@ -467,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'); @@ -483,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(), ))); } @@ -719,9 +721,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $num = $item ? $item->numChildren() : null; if($num) { return sprintf( - '%s', - $controller->Link(), - $item->ID, + '%s', + Controller::join_links($controller->Link(), "?ParentID={$item->ID}&view=list"), $num ); } @@ -845,8 +846,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $id = $id . $suffix; } - $newItem->Title = _t('CMSMain.NEW',"New ",'"New " followed by a className').$className; - $newItem->URLSegment = "new-" . strtolower($className); + $newItem->Title = _t( + 'CMSMain.NEWPAGE', + "New {pagetype}",'followed by a page type title', + array('pagetype' => singleton($className)->i18n_singular_name()) + ); $newItem->ClassName = $className; $newItem->ParentID = $parentID; diff --git a/code/controllers/CMSPageAddController.php b/code/controllers/CMSPageAddController.php index 81b17292..a16f6609 100644 --- a/code/controllers/CMSPageAddController.php +++ b/code/controllers/CMSPageAddController.php @@ -21,7 +21,7 @@ class CMSPageAddController extends CMSPageEditController { $pageTypes = array(); foreach($this->PageTypes() as $type) { $html = sprintf('%s%s', - $type->getField('ClassName'), + $type->getField('Title'), $type->getField('AddAction'), $type->getField('Description') ); diff --git a/code/controllers/ReportAdmin.php b/code/controllers/ReportAdmin.php index 18a5cfb2..0eeb6439 100644 --- a/code/controllers/ReportAdmin.php +++ b/code/controllers/ReportAdmin.php @@ -163,7 +163,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider { $gridField = new GridField('Reports',false, $this->Reports(), $gridFieldConfig); $columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns'); $columns->setDisplayFields(array( - 'title' => 'Title', + 'title' => _t('ReportAdmin.ReportTitle', 'Title'), )); $columns->setFieldFormatting(array( 'title' => '$value' diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index d10a1079..b4a25ef7 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -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()); } /** @@ -2709,14 +2711,17 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid function provideI18nEntities() { $entities = parent::provideI18nEntities(); - if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = FRAMEWORK_DIR; - if(isset($entities['Page.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = FRAMEWORK_DIR; + if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = CMS_DIR; + if(isset($entities['Page.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = CMS_DIR; $entities[$this->class . '.DESCRIPTION'] = array( $this->stat('description'), 'Description of the page type (shown in the "add page" dialog)' ); + $entities['SiteTree.SINGULARNAME'][0] = 'Page'; + $entities['SiteTree.PLURALNAME'][0] = 'Pages'; + return $entities; } diff --git a/lang/en.yml b/lang/en.yml index c7a41723..2843f388 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -13,6 +13,7 @@ en: CurrentFolderOnly: 'Limit to current folder?' DetailsView: Details FILES: Files + FILESYSTEMSYNC: 'Sync files' FILESYSTEMSYNCTITLE: 'Update the CMS database entries of files on the filesystem. Useful when new files have been uploaded outside of the CMS, e.g. through FTP.' FROMTHEINTERNET: 'From the internet' FROMYOURCOMPUTER: 'From your computer' @@ -82,7 +83,7 @@ en: EMAIL: Email EditTree: 'Edit Tree' ListFiltered: 'Filtered list.' - NEW: 'New ' + NEWPAGE: 'New {pagetype}' PAGENOTEXISTS: 'This page doesn''t exist' PAGES: Pages PAGETYPEANYOPT: Any @@ -236,6 +237,8 @@ en: REDIRECTTOPAGE: 'A page on your website' SINGULARNAME: 'Redirector Page' YOURPAGE: 'Page on your website' + ReportAdmin: + ReportTitle: Title ReportAdminForm: FILTERBY: 'Filter by' SearchForm: @@ -333,7 +336,7 @@ en: PARENTTYPE_SUBPAGE: 'Sub-page underneath a parent page' PERMISSION_GRANTACCESS_DESCRIPTION: 'Manage access rights for content' PERMISSION_GRANTACCESS_HELP: 'Allow setting of page-specific access restrictions in the "Pages" section.' - PLURALNAME: 'Site Tres' + PLURALNAME: Pages PageTypNotAllowedOnRoot: 'Page type "{type}" is not allowed on the root level' PageTypeNotAllowed: 'Page type "{type}" not allowed as child of this parent page' REMOVEDFROMDRAFTHELP: 'Page is published, but has been deleted from draft' @@ -343,7 +346,7 @@ en: REORGANISE_HELP: 'Rearrange pages in the site tree through drag&drop.' SHOWINMENUS: 'Show in menus?' SHOWINSEARCH: 'Show in search?' - SINGULARNAME: 'Site Tree' + SINGULARNAME: Page TABBEHAVIOUR: Behavior TABCONTENT: 'Main Content' TABDEPENDENT: 'Dependent pages' @@ -394,8 +397,6 @@ en: PLURALNAME: 'Virtual Pags' PageTypNotAllowedOnRoot: 'Original page type "{type}" is not allowed on the root level for this virtual page' SINGULARNAME: 'Virtual Page' - cms: - FILESYSTEMSYNC: 'Sync files' CMSFileAddController: MENUTITLE: Files CMSPageEditController: diff --git a/templates/Includes/CMSMain_TreeView.ss b/templates/Includes/CMSMain_TreeView.ss index 9c54d888..141c5c46 100644 --- a/templates/Includes/CMSMain_TreeView.ss +++ b/templates/Includes/CMSMain_TreeView.ss @@ -22,7 +22,7 @@ $ExtraTreeTools <% end_if %> -