class Token

Constants

private DEFAULT_LANGUAGE

Methods

__construct(string $token)

Token constructor

void
addOccurence(string $file, int $line)

Add a new occurence of this token in the sources

void
addTranslation(string $locale, string $translatedToken)

Adds a new translation for the given locale

bool
getDomain()

Returns the Domain of the token (e.g. default)

array
getOccurence()

Returns an array with all occurences of this token in the source

string|bool
getPluralToken()

Returns a plural tokenId if set or FALS if not

string
getTokenId($includeDomain = false)

Returns the token including the domain prefix

array|string
getTranslation($locale = false)

Returns an array with all available translations and the locale as array key

bool
hasTranslation($locale)

Returns true if a translation for the passed locale exists

bool|string
isEmpty($language = 'de_de')

No description

bool
isProbablyUntranslated($excludes = [], $language = 'de_de')

No description

mergeToken(Token $token)

Merges the passed Token object into this token. This will add additional translations as well as occurences from merged token into this

void
setDomain(string $domain)

Sets the domain for this token

setPluralToken($tokenId)

Adds a connected plural token

Details

at line 35
__construct(string $token)

Token constructor

Parameters

string $token

Technical Token ID (e.g. button.ok.label)

at line 45
void addOccurence(string $file, int $line)

Add a new occurence of this token in the sources

Parameters

string $file Filepath
int $line

Line in File

Return Value

void

at line 61
void addTranslation(string $locale, string $translatedToken)

Adds a new translation for the given locale

Parameters

string $locale

Locale, e.g. de_de

string $translatedToken

Translation String

Return Value

void

at line 100
bool getDomain()

Returns the Domain of the token (e.g. default)

Return Value

bool Domain

at line 141
array getOccurence()

Returns an array with all occurences of this token in the source

Return Value

array

at line 149
string|bool getPluralToken()

Returns a plural tokenId if set or FALS if not

Return Value

string|bool

at line 117
string getTokenId($includeDomain = false)

Returns the token including the domain prefix

Parameters

$includeDomain

Return Value

string

at line 129
array|string getTranslation($locale = false)

Returns an array with all available translations and the locale as array key

Parameters

$locale

Return Value

array|string

at line 83
bool hasTranslation($locale)

Returns true if a translation for the passed locale exists

Parameters

$locale string

Return Value

bool

Returns true if a translation exists

at line 181
bool|string isEmpty($language = 'de_de')

No description

Parameters

$language

Return Value

bool|string

at line 168
bool isProbablyUntranslated($excludes = [], $language = 'de_de')

No description

Parameters

$excludes
$language

Return Value

bool

at line 159
mergeToken(Token $token)

Merges the passed Token object into this token. This will add additional translations as well as occurences from merged token into this

Parameters

Token $token

at line 92
void setDomain(string $domain)

Sets the domain for this token

Parameters

string $domain

Token Domain

Return Value

void

at line 109
setPluralToken($tokenId)

Adds a connected plural token

Parameters

$tokenId

string Technical Token Id