Skip to content
This repository
Browse code

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])
  • Loading branch information...
commit 2e791abad2edf665792bebcfbcd8fcda1387ad4a 1 parent e6e2ab4
Ingo Schommer authored August 20, 2012
7  code/controllers/CMSMain.php
@@ -845,8 +845,11 @@ public function getNewItem($id, $setID = true) {
845 845
 		    	$id = $id . $suffix;
846 846
 	    }
847 847
 
848  
-		$newItem->Title = _t('CMSMain.NEW',"New ",'"New " followed by a className').$className;
849  
-		$newItem->URLSegment = "new-" . strtolower($className);
  848
+		$newItem->Title = _t(
  849
+			'CMSMain.NEWPAGE',
  850
+			"New {pagetype}",'followed by a page type title',
  851
+			array('pagetype' => singleton($className)->i18n_singular_name())
  852
+		);
850 853
 		$newItem->ClassName = $className;
851 854
 		$newItem->ParentID = $parentID;
852 855
 
7  code/model/SiteTree.php
@@ -2709,14 +2709,17 @@ function i18n_singular_name() {
2709 2709
 	function provideI18nEntities() {
2710 2710
 		$entities = parent::provideI18nEntities();
2711 2711
 		
2712  
-		if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = FRAMEWORK_DIR;
2713  
-		if(isset($entities['Page.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = FRAMEWORK_DIR;		
  2712
+		if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = CMS_DIR;
  2713
+		if(isset($entities['Page.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = CMS_DIR;		
2714 2714
 
2715 2715
 		$entities[$this->class . '.DESCRIPTION'] = array(
2716 2716
 			$this->stat('description'),
2717 2717
 			'Description of the page type (shown in the "add page" dialog)'
2718 2718
 		);
2719 2719
 
  2720
+		$entities['SiteTree.SINGULARNAME'][0] = 'Page';
  2721
+		$entities['SiteTree.PLURALNAME'][0] = 'Pages';
  2722
+
2720 2723
 		return $entities;
2721 2724
 	}
2722 2725
 	
6  lang/en.yml
@@ -82,7 +82,7 @@ en:
82 82
     EMAIL: Email
83 83
     EditTree: 'Edit Tree'
84 84
     ListFiltered: 'Filtered list.'
85  
-    NEW: 'New '
  85
+    NEWPAGE: 'New {pagetype}'
86 86
     PAGENOTEXISTS: 'This page doesn''t exist'
87 87
     PAGES: Pages
88 88
     PAGETYPEANYOPT: Any
@@ -333,7 +333,7 @@ en:
333 333
     PARENTTYPE_SUBPAGE: 'Sub-page underneath a parent page'
334 334
     PERMISSION_GRANTACCESS_DESCRIPTION: 'Manage access rights for content'
335 335
     PERMISSION_GRANTACCESS_HELP: 'Allow setting of page-specific access restrictions in the "Pages" section.'
336  
-    PLURALNAME: 'Site Tres'
  336
+    PLURALNAME: Pages
337 337
     PageTypNotAllowedOnRoot: 'Page type "{type}" is not allowed on the root level'
338 338
     PageTypeNotAllowed: 'Page type "{type}" not allowed as child of this parent page'
339 339
     REMOVEDFROMDRAFTHELP: 'Page is published, but has been deleted from draft'
@@ -343,7 +343,7 @@ en:
343 343
     REORGANISE_HELP: 'Rearrange pages in the site tree through drag&drop.'
344 344
     SHOWINMENUS: 'Show in menus?'
345 345
     SHOWINSEARCH: 'Show in search?'
346  
-    SINGULARNAME: 'Site Tree'
  346
+    SINGULARNAME: Page
347 347
     TABBEHAVIOUR: Behavior
348 348
     TABCONTENT: 'Main Content'
349 349
     TABDEPENDENT: 'Dependent pages'

0 notes on commit 2e791ab

Please sign in to comment.
Something went wrong with that request. Please try again.