Class ExtractTask
Language string extractor
- AppShell
- ExtractTask
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/Console/Command/Task/ExtractTask.php
Properties summary
-
$_exclude
protectedarray
An array of directories to exclude. -
$_extractCore
protectedboolean
Holds whether this call should extract the CakePHP Lib messages -
$_extractValidation
protectedboolean
Holds whether this call should extract model validation messages -
$_file
protectedstring
Current file being processed -
$_files
protectedarray
Files from where to extract -
$_merge
protectedboolean
Merge all domains string into the default.pot file -
$_output
protectedstring
Destination path -
$_paths
protectedstring
Paths to use when looking for strings -
$_storage
protectedstring
Contains all content waiting to be write -
$_tokens
protectedarray
Extracted tokens -
$_translations
protectedarray
Extracted strings indexed by domain. -
$_validationDomain
protectedboolean
Holds the validation string domain to use for validation messages when extracting
Method Summary
-
_addTranslation() protected
Add a translation to the internal translations property -
_buildFiles() protected
Build the translate template file contents out of obtained strings -
_extract() protected
Extract text -
_extractTokens() protected
Extract tokens out of all files to be processed -
_extractValidationMessages() protected
Looks for models in the application and extracts the validation messages to be added to the translation map
-
_formatString() protected
Format a string to be added as a translatable string -
_getPaths() protected
Method to interact with the User and get path selections. -
_getStrings() protected
Get the strings from the position forward -
_isExtractingApp() protected
Returns whether this execution is meant to extract string only from directories in folder represented by the APP constant, i.e. this task is extracting strings from same application.
-
_markerError() protected
Indicate an invalid marker on a processed file -
_parse() protected
Parse tokens -
_processValidationRules() protected
Process a validation rule for a field and looks for a message to be added to the translation map
-
_searchFiles() protected
Search files that may contain translatable strings -
_store() protected
Prepare a file to be stored -
_writeFiles() protected
Write the files that need to be stored -
_writeHeader() protected
Build the translation template header -
execute() public
Execution method always used for tasks -
getOptionParser() public
Get & configure the option parser
Method Detail
_addTranslation() protected ¶
_addTranslation( string $domain , string $msgid , array $details = array() )
Add a translation to the internal translations property
Takes care of duplicate translations
Parameters
- string $domain
- string $msgid
- array $details optional array()
_buildFiles() protected ¶
_buildFiles( )
Build the translate template file contents out of obtained strings
_extractValidationMessages() protected ¶
_extractValidationMessages( )
Looks for models in the application and extracts the validation messages to be added to the translation map
_formatString() protected ¶
_formatString( string $string )
Format a string to be added as a translatable string
Parameters
- string $string
- String to format
Returns
Formatted string
_getStrings() protected ¶
_getStrings( integer $position , integer $target )
Get the strings from the position forward
Parameters
- integer $position
- Actual position on tokens array
- integer $target
- Number of strings to extract
Returns
Strings extracted
_isExtractingApp() protected ¶
_isExtractingApp( )
Returns whether this execution is meant to extract string only from directories in folder represented by the APP constant, i.e. this task is extracting strings from same application.
Returns
_markerError() protected ¶
_markerError( string $file , integer $line , string $marker , integer $count )
Indicate an invalid marker on a processed file
Parameters
- string $file
- File where invalid marker resides
- integer $line
- Line number
- string $marker
- Marker found
- integer $count
- Count
_parse() protected ¶
_parse( string $functionName , array $map )
Parse tokens
Parameters
- string $functionName
- Function name that indicates translatable string (e.g: '__')
- array $map
- Array containing what variables it will find (e.g: domain, singular, plural)
_processValidationRules() protected ¶
_processValidationRules( string $field , array $rules , string $file , string $domain )
Process a validation rule for a field and looks for a message to be added to the translation map
Parameters
- string $field
- the name of the field that is being processed
- array $rules
- the set of validation rules for the field
- string $file
- the file name where this validation rule was found
- string $domain
- default domain to bind the validations to
_store() protected ¶
_store( string $domain , string $header , string $sentence )
Prepare a file to be stored
Parameters
- string $domain
- string $header
- string $sentence
_writeHeader() protected ¶
_writeHeader( )
Build the translation template header
Returns
Translation template header
Properties detail
$_extractCore ¶
Holds whether this call should extract the CakePHP Lib messages
false
$_extractValidation ¶
Holds whether this call should extract model validation messages
true
$_validationDomain ¶
Holds the validation string domain to use for validation messages when extracting
'default'