VuFind API Documentation

CopyStringCommand extends AbstractCommand
in package

Language command: copy string.

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Table of Contents

$filesToIgnore  : array<string|int, string>
Files to ignore when processing directories
$languageDir  : string
Language directory
$normalizer  : ExtendedIniNormalizer
Normalizer for .ini files
$reader  : ExtendedIniReader
Reader for .ini files
__construct()  : mixed
Constructor
addLineToFile()  : void
Add a line to a language file
applyReplaceRule()  : string
Apply a replacement rule, if necessary.
configure()  : void
Configure the command.
createMissingFiles()  : void
Create empty files if they do not already exist.
execute()  : int
Run the command.
extractTextDomain()  : array<string|int, mixed>
Extract a text domain and key from a raw language key.
getLangDir()  : object|bool
Open the language directory as an object using dir(). Return false on failure.
processDirectory()  : void
Process a language directory.

Properties

$filesToIgnore

Files to ignore when processing directories

protected array<string|int, string> $filesToIgnore = ['aliases.ini', 'native.ini']

Methods

__construct()

Constructor

public __construct([ExtendedIniNormalizer $normalizer = null ][, ExtendedIniReader $reader = null ][, string $languageDir = null ][, string|null $name = null ]) : mixed
Parameters
$normalizer : ExtendedIniNormalizer = null

Normalizer for .ini files

$reader : ExtendedIniReader = null

Reader for .ini files

$languageDir : string = null

Base language file directory

$name : string|null = null

The name of the command; passing null means it must be set in configure()

Return values
mixed

addLineToFile()

Add a line to a language file

protected addLineToFile(string $filename, string $key, string $value) : void
Parameters
$filename : string

File to update

$key : string

Name of language key

$value : string

Value of translation

Return values
void

applyReplaceRule()

Apply a replacement rule, if necessary.

protected applyReplaceRule(string $text, array<string|int, mixed> $rule) : string
Parameters
$text : string

Text to transform

$rule : array<string|int, mixed>

Replacement rule (empty for no change; [text to replace, replacement] array to apply a transformation)

Return values
string

configure()

Configure the command.

protected configure() : void
Return values
void

createMissingFiles()

Create empty files if they do not already exist.

protected createMissingFiles(string $path, array<string|int, mixed> $files) : void
Parameters
$path : string

Directory path

$files : array<string|int, mixed>

Filenames to create in directory

Return values
void

execute()

Run the command.

protected execute(InputInterface $input, OutputInterface $output) : int
Parameters
$input : InputInterface

Input object

$output : OutputInterface

Output object

Return values
int

0 for success

extractTextDomain()

Extract a text domain and key from a raw language key.

protected extractTextDomain(string $raw) : array<string|int, mixed>
Parameters
$raw : string

Raw language key

Return values
array<string|int, mixed>

[textdomain, key]

getLangDir()

Open the language directory as an object using dir(). Return false on failure.

protected getLangDir(OutputInterface $output[, string $domain = 'default' ][, bool $createIfMissing = false ]) : object|bool
Parameters
$output : OutputInterface

Output object

$domain : string = 'default'

Text domain to retrieve.

$createIfMissing : bool = false

Should we create a missing directory?

Return values
object|bool

processDirectory()

Process a language directory.

protected processDirectory(object $dir, callable $callback[, bool $statusCallback = false ]) : void
Parameters
$dir : object

Directory object from dir() to process

$callback : callable

Function to run on all .ini files in $dir

$statusCallback : bool = false

Callback function to display status messages (omit to suppress messages)

Return values
void

Search results