UtilTranslationsExtract extends AbstractCommand
UtilTranslationsExtract command. This command extracts translation strings from templates and allows saving them into a translation file. It can also display the extracted messages in the console.
Table of Contents
Constants
- CONFIG_FILE = ['cecil.yml', 'config.yml']
- EXCLUDED_CMD = ['about', 'new:site', 'self-update']
- TMP_DIR = '.cecil'
- EXCLUDED_CMD = ['about', 'new:site', 'self-update']
Properties
- $input : InputInterface
- $io : SymfonyStyle
- $output : OutputInterface
- $extractor : TwigExtractor
- $reader : TranslationReader
- $writer : TranslationWriter
- $io : SymfonyStyle
Methods
- getProcessedHelp() : string
- Override default help message.
- run() : int
- {@inheritdoc}
- validateUrl() : string
- Validate URL.
- binName() : string
- Returns the "binary name" in the console context.
- configure() : void
- execute() : int
- getBuilder() : Builder
- execute() : int
- Creates or returns a Builder instance.
- getConfigFiles() : array<string|int, mixed>
- Returns config file(s) path.
- getPath() : string|null
- Returns the working path.
- initialize() : mixed
- {@inheritdoc}
- locateAdditionalConfigFiles() : array<string|int, mixed>
- Locates additional configuration file(s) from the given list of files, relative to the given path or absolute.
- locateConfigFile() : array<string|int, mixed>
- Locates the configuration in the given path, as an array of the file name and path, if file exists, otherwise default name and false.
- openEditor() : void
- Opens path with editor.
- checkOptions() : void
- dumpMessages() : void
- extractMessages() : MessageCatalogue
- initTranslationComponents() : void
- initTwigExtractor() : void
- loadCurrentMessages() : MessageCatalogue
- saveDump() : void
- dumpMessages() : void
Constants
CONFIG_FILE
public
mixed
CONFIG_FILE
= ['cecil.yml', 'config.yml']
EXCLUDED_CMD
public
mixed
EXCLUDED_CMD
= ['about', 'new:site', 'self-update']
TMP_DIR
public
mixed
TMP_DIR
= '.cecil'
Properties
$input
protected
InputInterface
$input
$io
protected
SymfonyStyle
$io
$output
protected
OutputInterface
$output
$extractor
private
TwigExtractor
$extractor
$reader
private
TranslationReader
$reader
$writer
private
TranslationWriter
$writer
Methods
getProcessedHelp()
Override default help message.
public
getProcessedHelp() : string
Return values
stringrun()
{@inheritdoc}
public
run(InputInterface $input, OutputInterface $output) : int
Parameters
- $input : InputInterface
- $output : OutputInterface
Return values
intvalidateUrl()
Validate URL.
public
static validateUrl(string $url) : string
Parameters
- $url : string
Tags
Return values
stringbinName()
Returns the "binary name" in the console context.
protected
binName() : string
Return values
stringconfigure()
protected
configure() : void
execute()
protected
execute(InputInterface $input, OutputInterface $output) : int
Parameters
- $input : InputInterface
- $output : OutputInterface
Return values
intgetBuilder()
Creates or returns a Builder instance.
protected
getBuilder([array<string|int, mixed> $config = [] ]) : Builder
Parameters
- $config : array<string|int, mixed> = []
Tags
Return values
BuildergetConfigFiles()
Returns config file(s) path.
protected
getConfigFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>getPath()
Returns the working path.
protected
getPath([bool $exist = true ]) : string|null
Parameters
- $exist : bool = true
Return values
string|nullinitialize()
{@inheritdoc}
protected
initialize(InputInterface $input, OutputInterface $output) : mixed
Parameters
- $input : InputInterface
- $output : OutputInterface
locateAdditionalConfigFiles()
Locates additional configuration file(s) from the given list of files, relative to the given path or absolute.
protected
locateAdditionalConfigFiles(string $path, string $configFilesList) : array<string|int, mixed>
Parameters
- $path : string
- $configFilesList : string
Return values
array<string|int, mixed>locateConfigFile()
Locates the configuration in the given path, as an array of the file name and path, if file exists, otherwise default name and false.
protected
locateConfigFile(string $path) : array<string|int, mixed>
Parameters
- $path : string
Return values
array<string|int, mixed>openEditor()
Opens path with editor.
protected
openEditor(string $path, string $editor) : void
Parameters
- $path : string
- $editor : string
Tags
checkOptions()
private
checkOptions(InputInterface $input) : void
Parameters
- $input : InputInterface
dumpMessages()
private
dumpMessages(OperationInterface $operation) : void
Parameters
- $operation : OperationInterface
extractMessages()
private
extractMessages(string $locale, mixed $layoutsPath, string $prefix) : MessageCatalogue
Parameters
- $locale : string
- $layoutsPath : mixed
- $prefix : string
Return values
MessageCatalogueinitTranslationComponents()
private
initTranslationComponents() : void
initTwigExtractor()
private
initTwigExtractor([mixed $layoutsPath = [] ]) : void
Parameters
- $layoutsPath : mixed = []
loadCurrentMessages()
private
loadCurrentMessages(string $locale, string $translationsPath) : MessageCatalogue
Parameters
- $locale : string
- $translationsPath : string
Return values
MessageCataloguesaveDump()
private
saveDump(MessageCatalogueInterface $messageCatalogue, string $format, string $translationsPath) : void
Parameters
- $messageCatalogue : MessageCatalogueInterface
- $format : string
- $translationsPath : string