Permalink
Browse files

BUGFIX i18nTextCollector finds templates recursively, not only in <mo…

…dule>/templates folder. Added master language entities which were previously overlooked due to this bug.
  • Loading branch information...
chillu committed May 3, 2012
1 parent 42bc5ff commit f7e19ca680315fc61c5a5c36e8fd133bf1a88d2c
Showing with 35 additions and 11 deletions.
  1. +13 −9 i18n/i18nTextCollector.php
  2. +22 −2 lang/en.yml
View
@@ -159,8 +159,6 @@ public function run($restrictToModules = null) {
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 @@ protected function processModule($module) {
}
// 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 @@ public function collectFromTemplate($content, $fileName, $module) {
$entities[$this->normalizeEntity($entity, $module)] = $spec;
}
ksort($entities);
-
+
return $entities;
}
@@ -365,8 +364,9 @@ protected function normalizeEntity($fullName, $_namespace = null) {
*
* @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 @@ protected function getFilesRecursive($folder, &$fileList = null) {
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;
}
View
@@ -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 <small>(Allowed extensions: *.csv)</small>'
+ 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:

0 comments on commit f7e19ca

Please sign in to comment.