Constants

HEADER_LANGUAGE

HEADER_LANGUAGE

HEADER_PLURAL

HEADER_PLURAL

HEADER_DOMAIN

HEADER_DOMAIN

Properties

$options

$options : 

Type

$headers

$headers : 

Type

Methods

__construct()

__construct(  $input = array(),   $flags,   $iterator_class = 'ArrayIterator') 

Parameters

$input
$flags
$iterator_class

__callStatic()

__callStatic(  $name,   $arguments) : \Gettext\Translations

Magic method to create new instances using extractors For example: Translations::fromMoFile($filename, $options);.

Parameters

$name
$arguments

Returns

\Gettext\Translations

__call()

__call(  $name,   $arguments) : self|boolean

Magic method to import/export the translations to a specific format For example: $translations->toMoFile($filename, $options); For example: $translations->addFromMoFile($filename, $options);.

Parameters

$name
$arguments

Returns

self|boolean

__clone()

__clone() 

Magic method to clone each translation on clone the translations object.

offsetSet()

offsetSet(mixed  $index, \Gettext\Translation  $value) : \Gettext\Translation

Control the new translations added.

Parameters

mixed $index
\Gettext\Translation $value

Throws

\InvalidArgumentException

If the value is not an instance of Gettext\Translation

Returns

\Gettext\Translation

setPluralForms()

setPluralForms(integer  $count, string  $rule) : self

Set the plural definition.

Parameters

integer $count
string $rule

Returns

self

getPluralForms()

getPluralForms() 

Returns the parsed plural definition.

setHeader()

setHeader(string  $name, string  $value) : self

Set a new header.

Parameters

string $name
string $value

Returns

self

getHeader()

getHeader(string  $name) : null|string

Returns a header value.

Parameters

string $name

Returns

null|string

getHeaders()

getHeaders() : array

Returns all header for this translations (in alphabetic order).

Returns

array

deleteHeaders()

deleteHeaders() : self

Removes all headers.

Returns

self

deleteHeader()

deleteHeader(string  $name) : self

Removes one header.

Parameters

string $name

Returns

self

getLanguage()

getLanguage() : string

Returns the language value.

Returns

string —

$language

setLanguage()

setLanguage(string  $language) : self

Sets the language and the plural forms.

Parameters

string $language

Throws

\InvalidArgumentException

if the language hasn't been recognized

Returns

self

hasLanguage()

hasLanguage() : boolean

Checks whether the language is empty or not.

Returns

boolean

setDomain()

setDomain(string  $domain) : self

Set a new domain for this translations.

Parameters

string $domain

Returns

self

getDomain()

getDomain() : string

Returns the domain.

Returns

string

hasDomain()

hasDomain() : boolean

Checks whether the domain is empty or not.

Returns

boolean

find()

find(string|\Gettext\Translation  $context, string  $original = '') : \Gettext\Translation|false

Search for a specific translation.

Parameters

string|\Gettext\Translation $context

The context of the translation or a translation instance

string $original

The original string

Returns

\Gettext\Translation|false

countTranslated()

countTranslated() : integer

Count all elements translated

Returns

integer

insert()

insert(string  $context, string  $original, string  $plural = '') : \Gettext\Translation

Creates and insert/merges a new translation.

Parameters

string $context

The translation context

string $original

The translation original string

string $plural

The translation original plural string

Returns

\Gettext\Translation

The translation created

mergeWith()

mergeWith(\Gettext\Translations  $translations, integer  $options = \Gettext\Merge::DEFAULTS) : self

Merges this translations with other translations.

Parameters

\Gettext\Translations $translations

The translations instance to merge with

integer $options

Returns

self

()

() : 

static $this fromBladeFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromBladeString(string $string, array $options = [])

Returns

()

() : 

$this addFromBladeFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromBladeString(string $string, array $options = [])

Returns

()

() : 

static $this fromCsvFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromCsvString(string $string, array $options = [])

Returns

()

() : 

$this addFromCsvFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromCsvString(string $string, array $options = [])

Returns

toCsvFile()

toCsvFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toCsvString()

toCsvString(array  $options = []) : string

Parameters

array $options

Returns

string

()

() : 

static $this fromCsvDictionaryFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromCsvDictionaryString(string $string, array $options = [])

Returns

()

() : 

$this addFromCsvDictionaryFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromCsvDictionaryString(string $string, array $options = [])

Returns

toCsvDictionaryFile()

toCsvDictionaryFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toCsvDictionaryString()

toCsvDictionaryString(array  $options = []) : string

Parameters

array $options

Returns

string

()

() : 

static $this fromJedFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromJedString(string $string, array $options = [])

Returns

()

() : 

$this addFromJedFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromJedString(string $string, array $options = [])

Returns

toJedFile()

toJedFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toJedString()

toJedString(array  $options = []) : string

Parameters

array $options

Returns

string

()

() : 

static $this fromJsCodeFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromJsCodeString(string $string, array $options = [])

Returns

()

() : 

$this addFromJsCodeFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromJsCodeString(string $string, array $options = [])

Returns

()

() : 

static $this fromJsonFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromJsonString(string $string, array $options = [])

Returns

()

() : 

$this addFromJsonFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromJsonString(string $string, array $options = [])

Returns

toJsonFile()

toJsonFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toJsonString()

toJsonString(array  $options = []) : string

Parameters

array $options

Returns

string

()

() : 

static $this fromJsonDictionaryFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromJsonDictionaryString(string $string, array $options = [])

Returns

()

() : 

$this addFromJsonDictionaryFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromJsonDictionaryString(string $string, array $options = [])

Returns

toJsonDictionaryFile()

toJsonDictionaryFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toJsonDictionaryString()

toJsonDictionaryString(array  $options = []) : string

Parameters

array $options

Returns

string

()

() : 

static $this fromMoFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromMoString(string $string, array $options = [])

Returns

()

() : 

$this addFromMoFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromMoString(string $string, array $options = [])

Returns

toMoFile()

toMoFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toMoString()

toMoString(array  $options = []) : string

Parameters

array $options

Returns

string

()

() : 

static $this fromPhpArrayFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromPhpArrayString(string $string, array $options = [])

Returns

()

() : 

$this addFromPhpArrayFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromPhpArrayString(string $string, array $options = [])

Returns

toPhpArrayFile()

toPhpArrayFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toPhpArrayString()

toPhpArrayString(array  $options = []) : string

Parameters

array $options

Returns

string

()

() : 

static $this fromPhpCodeFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromPhpCodeString(string $string, array $options = [])

Returns

()

() : 

$this addFromPhpCodeFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromPhpCodeString(string $string, array $options = [])

Returns

()

() : 

static $this fromPoFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromPoString(string $string, array $options = [])

Returns

()

() : 

$this addFromPoFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromPoString(string $string, array $options = [])

Returns

toPoFile()

toPoFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toPoString()

toPoString(array  $options = []) : string

Parameters

array $options

Returns

string

()

() : 

static $this fromTwigFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromTwigString(string $string, array $options = [])

Returns

()

() : 

$this addFromTwigFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromTwigString(string $string, array $options = [])

Returns

()

() : 

static $this fromXliffFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromXliffString(string $string, array $options = [])

Returns

()

() : 

$this addFromXliffFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromXliffString(string $string, array $options = [])

Returns

toXliffFile()

toXliffFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toXliffString()

toXliffString(array  $options = []) : string

Parameters

array $options

Returns

string

()

() : 

static $this fromYamlFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromYamlString(string $string, array $options = [])

Returns

()

() : 

$this addFromYamlFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromYamlString(string $string, array $options = [])

Returns

toYamlFile()

toYamlFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toYamlString()

toYamlString(array  $options = []) : string

Parameters

array $options

Returns

string

()

() : 

static $this fromYamlDictionaryFile(string $filename, array $options = [])

Returns

()

() : 

static $this fromYamlDictionaryString(string $string, array $options = [])

Returns

()

() : 

$this addFromYamlDictionaryFile(string $filename, array $options = [])

Returns

()

() : 

$this addFromYamlDictionaryString(string $string, array $options = [])

Returns

toYamlDictionaryFile()

toYamlDictionaryFile(string  $filename, array  $options = []) : boolean

Parameters

string $filename
array $options

Returns

boolean

toYamlDictionaryString()

toYamlDictionaryString(array  $options = []) : string

Parameters

array $options

Returns

string