From 2e791abad2edf665792bebcfbcd8fcda1387ad4a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 20 Aug 2012 22:25:18 +0200 Subject: [PATCH] Better i18n for "new page" label (fixes #7796) Also using better standard name for auto generated page names ("Page" instead of "Site Tree", "Pages" instead of "Site Tres" [sic]) --- code/controllers/CMSMain.php | 7 +++++-- code/model/SiteTree.php | 7 +++++-- lang/en.yml | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 45cfcdb7..25db14d2 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -845,8 +845,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/model/SiteTree.php b/code/model/SiteTree.php index d10a1079..84e770b0 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -2709,14 +2709,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..f0e7c730 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -82,7 +82,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 @@ -333,7 +333,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 +343,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'