CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.5 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.5
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • BakeTask
  • CommandTask
  • ControllerTask
  • DbConfigTask
  • ExtractTask
  • FixtureTask
  • ModelTask
  • PluginTask
  • ProjectTask
  • TemplateTask
  • TestTask
  • ViewTask

Class ExtractTask

Language string extractor

AppShell
Extended by ExtractTask
Package: Cake\Console\Command\Task
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Console/Command/Task/ExtractTask.php

Properties summary

  • $_exclude protected
    array
    An array of directories to exclude.
  • $_extractCore protected
    boolean
    Holds whether this call should extract the CakePHP Lib messages
  • $_extractValidation protected
    boolean
    Holds whether this call should extract model validation messages
  • $_file protected
    string
    Current file being processed
  • $_files protected
    array
    Files from where to extract
  • $_merge protected
    boolean
    Merge all domain and category strings into the default.pot file
  • $_output protected
    string
    Destination path
  • $_paths protected
    string
    Paths to use when looking for strings
  • $_storage protected
    string
    Contains all content waiting to be write
  • $_tokens protected
    array
    Extracted tokens
  • $_translations protected
    array
    Extracted strings indexed by category and domain.
  • $_validationDomain protected
    boolean
    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
  • _extractPluginValidationMessages() protected
    Extract validation messages from application or plugin models
  • _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.

  • _isPathUsable() protected
    Checks whether or not a given path is usable for writing.
  • _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
    Gets the option parser instance and configures it.

Method Detail

_addTranslation() protected ¶

_addTranslation( string $category , string $domain , string $msgid , array $details = array() )

Add a translation to the internal translations property

Takes care of duplicate translations

Parameters
string $category
The category
string $domain
The domain
string $msgid
The message string
array $details optional array()
The file and line references

_buildFiles() protected ¶

_buildFiles( )

Build the translate template file contents out of obtained strings

_extract() protected ¶

_extract( )

Extract text

_extractPluginValidationMessages() protected ¶

_extractPluginValidationMessages( string $plugin = null )

Extract validation messages from application or plugin models

Parameters
string $plugin optional null
Plugin name or null to process application models

_extractTokens() protected ¶

_extractTokens( )

Extract tokens out of all files to be processed

_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
string
Formatted string

_getPaths() protected ¶

_getPaths( )

Method to interact with the User and get path selections.

_getStrings() protected ¶

_getStrings( integer $position , integer $target )

Get the strings from the position forward

Parameters
integer $position
$position Actual position on tokens array
integer $target
Number of strings to extract
Returns
array
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
boolean

_isPathUsable() protected ¶

_isPathUsable( string $path )

Checks whether or not a given path is usable for writing.

Parameters
string $path
Path to folder
Returns
boolean
true if it exists and is writable, false otherwise

_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: category, domain, singular, plural)

_processValidationRules() protected ¶

_processValidationRules( string $field , array $rules , string $file , string $domain , string $category = 'LC_MESSAGES' )

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
string $category optional 'LC_MESSAGES'
the translation category

_searchFiles() protected ¶

_searchFiles( )

Search files that may contain translatable strings

_store() protected ¶

_store( string $category , string $domain , string $header , string $sentence )

Prepare a file to be stored

Parameters
string $category
The category
string $domain
The domain
string $header
The header content.
string $sentence
The sentence to store.

_writeFiles() protected ¶

_writeFiles( )

Write the files that need to be stored

_writeHeader() protected ¶

_writeHeader( )

Build the translation template header

Returns
string
Translation template header

execute() public ¶

execute( )

Execution method always used for tasks

getOptionParser() public ¶

getOptionParser( )

Gets the option parser instance and configures it.

Returns
ConsoleOptionParser

Properties detail

$_exclude ¶

protected array

An array of directories to exclude.

array()

$_extractCore ¶

protected boolean

Holds whether this call should extract the CakePHP Lib messages

false

$_extractValidation ¶

protected boolean

Holds whether this call should extract model validation messages

true

$_file ¶

protected string

Current file being processed

null

$_files ¶

protected array

Files from where to extract

array()

$_merge ¶

protected boolean

Merge all domain and category strings into the default.pot file

false

$_output ¶

protected string

Destination path

null

$_paths ¶

protected string

Paths to use when looking for strings

array()

$_storage ¶

protected string

Contains all content waiting to be write

array()

$_tokens ¶

protected array

Extracted tokens

array()

$_translations ¶

protected array

Extracted strings indexed by category and domain.

array()

$_validationDomain ¶

protected boolean

Holds the validation string domain to use for validation messages when extracting

'default'
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs