Apache Zeta Components Manual :: Docs For Class ezcTemplateTranslationStringExtracter
TemplateTranslationTiein::ezcTemplateTranslationStringExtracter
Class ezcTemplateTranslationStringExtracter
A visiter that can be used to extract translatable strings from a template.
Implements the ezcTemplateTstNodeVisiter interface for visiting the nodes and extracting translatable strings from them. It can be used like:
- <?php
- $source = new ezcTemplateSourceCode( $file, $file );
- $source->load();
- $tst = $parser->parseIntoNodeTree();
- $eted = $tst->accept( $et );
- ?>
Source for this file: /TemplateTranslationTiein/src/visitors/string_extracter.php
ezcTemplateTstWalker | --ezcTemplateTranslationStringExtracter
Version: | //autogen// |
Member Variables
protected array(string=>array(ezcTranslationData) |
$strings
Contans an array of arrays, where the key is the context, and the value an array of ezcTranslationData elements. |
public string |
$translationContext
Contains the active default translation context |
Method Summary
public ezcTemplateTranslationStringExtracter |
__construct(
$parser
)
Initialize the transformer, after this send this object to the accept() method on a node. |
public array(string=>array(ezcTranslationData)) |
getStrings(
)
Returns an array of translation objects indexed by context |
public array(string=>ezcTranslation) |
getTranslation(
)
Returns an array of translation datamaps indexed by context |
public string |
visitLiteralTstNode(
$type
)
Transform the literal from a TST node to a string. |
public void |
visitTranslationContextTstNode(
$node
)
visitTranslationContextTstNode |
public void |
visitTranslationTstNode(
$node
)
visitTranslationTstNode |
Methods
__construct
Initialize the transformer, after this send this object to the accept() method on a node.
Parameters:
Name | Type | Description |
---|---|---|
$parser |
ezcTemplateParser | The main parser object. |
getStrings
Returns an array of translation objects indexed by context
getTranslation
Returns an array of translation datamaps indexed by context
visitLiteralTstNode
Transform the literal from a TST node to a string.
The text will transformed by processing the escape sequences according to the type which is either ezcTemplateLiteralTstNode::SINGLE_QUOTE or ezcTemplateLiteralTstNode::DOUBLE_QUOTE.
Parameters:
Name | Type | Description |
---|---|---|
$type |
ezcTemplateLiteralTstNode |
visitTranslationContextTstNode
visitTranslationContextTstNode
Parameters:
Name | Type | Description |
---|---|---|
$node |
ezcTemplateTranslationContextTstNode |
visitTranslationTstNode
visitTranslationTstNode
Parameters:
Name | Type | Description |
---|---|---|
$node |
ezcTemplateTranslationTstNode |