PHP Class Bolt\Translation\TranslationFile

Mostra file Open project: bolt/bolt Class Usage Examples

Public Methods

Method Description
__construct ( Silex\Application $app, string $domain, string $locale ) Constructor.
content ( ) : string Gets all translatable strings and returns a translationsfile for messages or contenttypes.
isWriteAllowed ( ) : boolean Checks if translations file is allowed to write to.
path ( ) : array Get the path to a tranlsation resource.

Private Methods

Method Description
addTranslatable ( string $text ) Adds a string to the internal list of translatable strings.
buildNewContent ( array $newTranslations, array $savedTranslations, array $hinting = [] ) : string Builds the translations file data with added translations.
buildPath ( string $domain, string $locale ) : array Get the path to a tranlsation resource.
contentContenttypes ( ) : string Gets all translatable strings and returns a translationsfile for messages or contenttypes.
contentInfo ( ) : string Get the content of the info translation file or the fallback file.
contentMessages ( ) : string Gets all translatable strings and returns a translationsfile for messages or contenttypes.
gatherTranslatableStrings ( ) : array Find all twig templates and bolt php code, extract translatables strings, merge with existing translations.
readSavedTranslations ( ) : array Parses translations file and returns translations.
scanContenttypeFields ( ) Add fields names and labels for contenttype (forms) to the list of translatable strings.
scanContenttypeRelations ( ) Add relation names and labels to the list of translatable strings.
scanPhpFiles ( ) Scan php files for __('.
scanTaxonomies ( ) Add name ans singular names for taxonomies to the list of translatable strings.
scanTwigFiles ( ) Scan twig templates for __('.

Method Details

__construct() public method

Constructor.
public __construct ( Silex\Application $app, string $domain, string $locale )
$app Silex\Application
$domain string Requested resource
$locale string Requested locale

content() public method

Gets all translatable strings and returns a translationsfile for messages or contenttypes.
public content ( ) : string
return string

isWriteAllowed() public method

Checks if translations file is allowed to write to.
public isWriteAllowed ( ) : boolean
return boolean

path() public method

Get the path to a tranlsation resource.
public path ( ) : array
return array [absolute path, relative path]