class PoItem (View source)

PoItem handles one translation.

Constants

DELIMITER

The delimiter used to split plural strings.

This is the ETX (End of text) character and is used as a minimal means to separate singular and plural variants in source and translation text. It was found to be the most compatible delimiter for the supported databases.

Properties

protected string $langcode

The language code this translation is in.

protected string $context

The context this translation belongs to.

protected string|array $source

The source string or array of strings if it has plurals.

protected bool $plural

Flag indicating if this translation has plurals.

protected string $comment

The comment of this translation.

protected string|array $translation

The translation string or array of strings if it has plurals.

Methods

string
getLangcode()

Gets the language code of the currently used language.

setLangcode(string $langcode)

Set the language code of the current language.

string
getContext()

Gets the context this translation belongs to.

setContext(string $context)

Set the context this translation belongs to.

string
getSource()

Gets the source string or the array of strings if the translation has plurals.

setSource(string|array $source)

Set the source string or the array of strings if the translation has plurals.

string
getTranslation()

Gets the translation string or the array of strings if the translation has plurals.

setTranslation(string|array $translation)

Set the translation string or the array of strings if the translation has plurals.

setPlural(bool $plural)

Set if the translation has plural values.

bool
isPlural()

Get if the translation has plural values.

string
getComment()

Gets the comment of this translation.

setComment(string $comment)

Set the comment of this translation.

setFromArray(array $values = [])

Create the PoItem from a structured array.

__toString()

Output the PoItem as a string.

Details

string getLangcode()

Gets the language code of the currently used language.

Return Value

string

with langcode

setLangcode(string $langcode)

Set the language code of the current language.

Parameters

string $langcode

The language code of the current language.

string getContext()

Gets the context this translation belongs to.

Return Value

string $context

setContext(string $context)

Set the context this translation belongs to.

Parameters

string $context

The context this translation belongs to.

string getSource()

Gets the source string or the array of strings if the translation has plurals.

Return Value

string

or array $translation

setSource(string|array $source)

Set the source string or the array of strings if the translation has plurals.

Parameters

string|array $source

The source string or the array of strings if the translation has plurals.

string getTranslation()

Gets the translation string or the array of strings if the translation has plurals.

Return Value

string

or array $translation

setTranslation(string|array $translation)

Set the translation string or the array of strings if the translation has plurals.

Parameters

string|array $translation

The translation string or the array of strings if the translation has plurals.

setPlural(bool $plural)

Set if the translation has plural values.

Parameters

bool $plural

TRUE, if the translation has plural values. FALSE otherwise.

bool isPlural()

Get if the translation has plural values.

Return Value

bool

string getComment()

Gets the comment of this translation.

Return Value

string $comment

setComment(string $comment)

Set the comment of this translation.

Parameters

string $comment

The comment of this translation.

setFromArray(array $values = [])

Create the PoItem from a structured array.

Parameters

array $values

A structured array to create the PoItem from.

__toString()

Output the PoItem as a string.