From f7e19ca680315fc61c5a5c36e8fd133bf1a88d2c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 3 May 2012 17:45:25 +0200 Subject: [PATCH] BUGFIX i18nTextCollector finds templates recursively, not only in /templates folder. Added master language entities which were previously overlooked due to this bug. --- i18n/i18nTextCollector.php | 22 +++++++++++++--------- lang/en.yml | 24 ++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/i18n/i18nTextCollector.php b/i18n/i18nTextCollector.php index fb5503830..6879d2fc9 100644 --- a/i18n/i18nTextCollector.php +++ b/i18n/i18nTextCollector.php @@ -159,8 +159,6 @@ class i18nTextCollector extends Object { protected function processModule($module) { $entities = array(); - //Debug::message("Processing Module '{$module}'", false); - // Search for calls in code files if these exists $fileList = array(); if(is_dir("$this->basePath/$module/code")) { @@ -179,8 +177,9 @@ class i18nTextCollector extends Object { } // Search for calls in template files if these exists - if(is_dir("$this->basePath/$module/templates")) { - $fileList = $this->getFilesRecursive("$this->basePath/$module/templates"); + if(is_dir("$this->basePath/$module/")) { + $dummy = array(); + $fileList = $this->getFilesRecursive("$this->basePath/$module/", $dummy, 'ss'); foreach($fileList as $index => $filePath) { $content = file_get_contents($filePath); // templates use their filename as a namespace @@ -302,7 +301,7 @@ class i18nTextCollector extends Object { $entities[$this->normalizeEntity($entity, $module)] = $spec; } ksort($entities); - + return $entities; } @@ -365,8 +364,9 @@ class i18nTextCollector extends Object { * * @param string $folder base directory to scan (will scan recursively) * @param array $fileList Array where potential files will be added to + * @param String $type Optional, "php" or "ss" */ - protected function getFilesRecursive($folder, &$fileList = null) { + protected function getFilesRecursive($folder, &$fileList = null, $type = null) { if(!$fileList) $fileList = array(); $items = scandir($folder); $isValidFolder = ( @@ -376,9 +376,13 @@ class i18nTextCollector extends Object { if($items && $isValidFolder) foreach($items as $item) { if(substr($item,0,1) == '.') continue; - if(substr($item,-4) == '.php') $fileList[substr($item,0,-4)] = "$folder/$item"; - else if(substr($item,-3) == '.ss') $fileList[$item] = "$folder/$item"; - else if(is_dir("$folder/$item")) $this->getFilesRecursive("$folder/$item", $fileList); + if(substr($item,-4) == '.php' && (!$type || $type == 'php')) { + $fileList[substr($item,0,-4)] = "$folder/$item"; + } + else if(substr($item,-3) == '.ss' && (!$type || $type == 'ss')) { + $fileList[$item] = "$folder/$item"; + } + else if(is_dir("$folder/$item")) $this->getFilesRecursive("$folder/$item", $fileList, $type); } return $fileList; } diff --git a/lang/en.yml b/lang/en.yml index 751121af7..9c2932acd 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -46,6 +46,8 @@ en: UNORDERED: 'Unordered list' UNORDEREDDESCRIPTION: 'Unordered list' UNORDEREDEXAMPLE1: 'unordered item 1' + BackLink_Button.ss: + Back: Back BasicAuth: ENTERINFO: 'Please enter a username and password.' ERRORNOTADMIN: 'That user is not an administrator.' @@ -54,6 +56,8 @@ en: ANY: Any NO: No YES: Yes + CMSLoadingScreen.ss: + LOADING: Loading... CMSMain: ACCESS: 'Access to ''{title}'' section' ACCESSALLINTERFACES: 'Access to all CMS sections' @@ -264,8 +268,13 @@ en: PERMALREADY: 'I''m sorry, but you can''t access that part of the CMS. If you want to log in as someone else, do so below' PERMDEFAULT: 'Please choose an authentication method and enter your credentials to access the CMS.' PLEASESAVE: 'Please Save Page: This page could not be upated because it hasn''t been saved yet.' + PreviewButton: Preview SAVED: saved VersionUnknown: unknown + LeftAndMain.ss: + VIEWPAGEIN: 'Page view:' + LeftAndMain_Menu.ss: + LOGOUT: 'Log out' LoginAttempt: Email: 'Email Address' IP: 'IP Address' @@ -359,7 +368,17 @@ en: NOCSVFILE: 'Please browse for a CSV file to import' NOIMPORT: 'Nothing to import' RESET: Reset + Title: 'Data Models' UPDATEDRECORDS: 'Updated {count} records.' + ModelAdmin_ImportSpec.ss: + IMPORTSPECFIELDS: 'Database columns' + IMPORTSPECRELATIONS: Relations + ModelAdmin_Tools.ss: + FILTER: Filter + IMPORT: Import + ModelSidebar.ss: + IMPORT_TAB_HEADER: Import + SEARCHLISTINGS: Search MoneyField: FIELDLABELAMOUNT: Amount FIELDLABELCURRENCY: Currency @@ -418,6 +437,9 @@ en: SecurityAdmin_MemberImportForm: BtnImport: 'Import from CSV' FileFieldLabel: 'CSV File (Allowed extensions: *.csv)' + SilverStripeNavigator: + Edit: Edit + OpenNewWindow: 'Open in new window' SimpleImageField: NOUPLOAD: 'No Image Uploaded' SiteTree: @@ -439,8 +461,6 @@ en: VIEWLAST: 'View last' VIEWNEXT: 'View next' VIEWPREVIOUS: 'View previous' - TextareaField_Readonly.ss: - NONE: none TimeField: VALIDATEFORMAT: 'Please enter a valid time format ({format})' ToggleCompositeField.ss: