TemplateTranslationTiein: ezcTemplateTranslationExtractor
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcTemplateTranslationExtractor
|
ezcTemplateTranslationExtractor is capable of creating or updating translation files by extracting translatable strings from templates. [
source]
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:
1. $ 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
1. $ php TemplateTranslationTiein/src/runextractor.php
or
1. $ php TemplateTranslationTiein/src/runextractor.php -h
for extended help information.
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
ezcTemplateTranslationExtractor __construct(
)
Create a new generator.
This method initializes the necessary objects to run the application.
getTranslationsFromTemplate
array(string=>array(ezcTranslationData)) getTranslationsFromTemplate(
string
$filename )
Get translation array with translation data for each context from the template.
Parameters
| Name |
Type |
Description |
$filename |
string |
|
getTranslationsFromTsFile
array(string=>ezcTranslationData) getTranslationsFromTsFile(
string
$contextName )
Get translations for given context.
Parameters
| Name |
Type |
Description |
$contextName |
string |
|
run
void run(
)
Run the generator.
Process the given options and generates translation files.
unifyFilepath
string unifyFilepath(
string
$pathname, string
$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.
Parameters
| Name |
Type |
Description |
$pathname |
string |
|
$templatePath |
string |
|
Last updated: Mon, 21 Dec 2009