Class i18nTextCollector
SilverStripe-variant of the "gettext" tool: Parses the string content of all
PHP-files and SilverStripe templates for ocurrences of the _t() translation
method. Also uses the i18nEntityProvider interface to get dynamically
defined entities by executing the provideI18nEntities() method on all
implementors of this interface.
Collects all found entities (and their natural language text for the default locale) into language-files for each module in an array notation. Creates or overwrites these files, e.g. sapphire/lang/en_US.php.
The collector needs to be run whenever you make new translatable entities available. Please don't alter the arrays in language tables manually.
Usage through URL: http://localhost/dev/tasks/i18nTextCollectorTast Usage through URL (module-specific): http://localhost/dev/tasks/i18nTextCollectorTask/?module=mymodule Usage on CLI: sake dev/tasks/i18nTextCollectorTask Usage on CLI (module-specific): sake dev/tasks/i18nTextCollectorTask module=mymodule
Requires PHP 5.1+ due to class_implements() limitations
- Object
-
i18nTextCollector
Author: Bernat Foj Capell <bernat@silverstripe.com>
Author: Ingo Schommer <FIRSTNAME@silverstripe.com>
Uses:
i18nEntityProvider Uses:
i18n Located at sapphire/core/i18nTextCollector.php
Methods summary
public
|
|
public
|
|
protected
|
|
public
|
|
public
|
|
public
|
|
protected
|
|
public
|
#
langArrayCodeForEntitySpec( string $entityFullName, mixed $entitySpec )
Input for langArrayCodeForEntitySpec() should be suitable for insertion into single-quoted strings, so needs to be escaped already. |
protected
|
#
writeMasterStringFile( mixed $entitiesByModule )
Write the master string table of every processed module |
protected
|
#
getFilesRecursive( string $folder, array & $fileList = null )
Helper function that searches for potential files to be parsed |
public
|
|
public
|
Methods inherited from Object
__call(),
__toString(),
__wakeup(),
addMethodsFrom(),
addStaticVars(),
addWrapperMethod(),
add_extension(),
add_static_var(),
allMethodNames(),
cacheToFile(),
cacheToFileWithArgs(),
clearCache(),
combined_static(),
create(),
createMethod(),
create_from_string(),
defineMethods(),
exists(),
extInstance(),
extend(),
getCustomClass(),
getExtensionInstance(),
getExtensionInstances(),
get_extensions(),
get_static(),
hasExtension(),
hasMethod(),
has_extension(),
invokeWithExtensions(),
is_a(),
loadCache(),
parentClass(),
parse_class_spec(),
remove_extension(),
sanitiseCachename(),
saveCache(),
set_stat(),
set_static(),
set_uninherited(),
stat(),
strong_create(),
uninherited(),
uninherited_static(),
useCustomClass()
Magic methods summary
Properties summary
protected
mixed
|
$defaultLocale | |
public
string
|
$basePath |
#
$basePath The directory base on which the collector should act. Usually the
webroot set through |
public
string
|
$baseSavePath |
#
$basePath The directory base on which the collector should create new lang
folders and files. Usually the webroot set through |