Apache Zeta Components Manual :: Docs For Class ezcTemplateTranslationExtractor
TemplateTranslationTiein::ezcTemplateTranslationExtractor
Class ezcTemplateTranslationExtractor
ezcTemplateTranslationExtractor is capable of creating or updating translation files by extracting translatable strings from templates.
To run the extractor, please use the file "runextractor.php", inside this package.
To extract new translatable strings from a template file, use the following synopsis:
- $ php TemplateTranslationTiein/src/runextractor.php -t path/to/template/files/ path/to/translation/files/
The -t / --templates parameter points to the template files. The -o / --overwrite option specifies if existing files should be overwritten instead of being updated. The argument for the program specifies the directory, where the translation files will be stored or updated.
For help information simply call
- $ php TemplateTranslationTiein/src/runextractor.php
- $ php TemplateTranslationTiein/src/runextractor.php -h
Source for this file: /TemplateTranslationTiein/src/extractor.php
Version: | //autogen// |
Constants
PROGRAM_DESCRIPTION
= 'Extracts translatable strings from eZ Components template files. The directory to save the translation files to is provided as an argument.'
|
Program description for help text. |
Method Summary
public ezcTemplateTranslationExtractor |
__construct(
)
Create a new generator. |
public array(string=>array(ezcTranslationData)) |
getTranslationsFromTemplate(
$filename
)
Get translation array with translation data for each context from the template. |
public array(string=>ezcTranslationData) |
getTranslationsFromTsFile(
$contextName
)
Get translations for given context. |
public void |
run(
)
Run the generator. |
public string |
unifyFilepath(
$pathname
, $templatePath
)
Unifies directory seperator accross platforms and strips path to the template dir to get the possibility to run this script from different template locations. |
Methods
__construct
Create a new generator.
This method initializes the necessary objects to run the application.
getTranslationsFromTemplate
Get translation array with translation data for each context from the template.
Parameters:
Name | Type | Description |
---|---|---|
$filename |
string |
getTranslationsFromTsFile
Get translations for given context.
Parameters:
Name | Type | Description |
---|---|---|
$contextName |
string |
run
Run the generator.
Process the given options and generates translation files.
unifyFilepath
Unifies directory seperator accross platforms and strips path to the template dir to get the possibility to run this script from different template locations.
Parameters:
Name | Type | Description |
---|---|---|
$pathname |
string | |
$templatePath |
string |