class Language implements ArrayAccess, Countable, IteratorAggregate

Class Language

Constants

DEFAULT_FILE_KEY

Methods

init()

{@inheritDoc}

t($key, array $args = [], $lang = '')

{@inheritdoc}

tl($key, array $args = [], $lang = null)

{@inheritdoc}

trans($key, array $args = [], $lang = null)

{@inheritdoc}

string|array
translate(string|bool $key, array $args = [], string $lang = null)

how to use language translate ? please see '/doc/language.md'

mixed
set(string $key, mixed $value)

No description

mixed
has(string $key)

No description

string|mixed
findTranslationText(string $key)

No description

string|mixed
transByFallbackLang(string $key)

No description

string
buildLangFilePath(string $filename, string $lang = '')

No description

string|null
getLangFile(string $fileKey)

No description

bool
hasLangFile(string $fileKey)

No description

bool
addLangFile(string $file, string $fileKey = null)

No description

bool
hasLangFileData($fileKey)

No description

bool
hasLang(string $lang)

No description

bool
isLang(string $lang)

No description

mixed|string
__get(string $name)

Allow quick access default file translate by $lang->key, is equals to $lang->tl('key').

__isset($name)

No description

__set($name, $value)

No description

mixed|string
__call(string $name, array $args)

Allow quick access default file translate by $lang->key(), is equals to $lang->tl('key').

string
getLang()

No description

setLang(string $lang)

No description

string[]
getLangs()

No description

setLangs(array $langs)

No description

string
getBasePath()

No description

setBasePath(string $path)

No description

getData()

No description

array
getLangFiles()

No description

setLangFiles(array $langFiles)

No description

string
getDefaultFile(bool $full = false)

No description

string
getFallbackLang()

No description

setFallbackLang(string $fallbackLang)

No description

getFallbackData()

No description

string
getFormat()

No description

setFormat(string $format)

No description

string
getSeparator()

No description

setSeparator(string $separator)

No description

array
getLoadedFiles()

No description

bool
isIgnoreError()

No description

setIgnoreError(bool $ignoreError)

No description

getIterator()

Retrieve an external iterator

boolean
offsetExists(mixed $offset)

Whether a offset exists

mixed
offsetGet(mixed $offset)

Offset to retrieve

void
offsetSet(mixed $offset, mixed $value)

Offset to set

void
offsetUnset(mixed $offset)

Offset to unset

int
count()

Count elements of an object

Details

at line 102
protected init()

{@inheritDoc}

Exceptions

RangeException

at line 121
t($key, array $args = [], $lang = '')

{@inheritdoc}

Parameters

$key
array $args
$lang

Exceptions

InvalidArgumentException
NotFoundException

See also

Language::translate

at line 132
tl($key, array $args = [], $lang = null)

{@inheritdoc}

Parameters

$key
array $args
$lang

Exceptions

InvalidArgumentException
NotFoundException

See also

Language::translate

at line 143
trans($key, array $args = [], $lang = null)

{@inheritdoc}

Parameters

$key
array $args
$lang

Exceptions

InvalidArgumentException
NotFoundException

See also

Language::translate

at line 156
string|array translate(string|bool $key, array $args = [], string $lang = null)

how to use language translate ? please see '/doc/language.md'

Parameters

string|bool $key
array $args
string $lang

Return Value

string|array

Exceptions

InvalidArgumentException

at line 194
mixed set(string $key, mixed $value)

Parameters

string $key
mixed $value

Return Value

mixed

at line 203
mixed has(string $key)

Parameters

string $key

Return Value

mixed

at line 212
protected string|mixed findTranslationText(string $key)

Parameters

string $key

Return Value

string|mixed

at line 244
protected string|mixed transByFallbackLang(string $key)

Parameters

string $key

Return Value

string|mixed

Exceptions

RangeException

at line 320
protected string buildLangFilePath(string $filename, string $lang = '')

Parameters

string $filename
string $lang

Return Value

string

at line 335
string|null getLangFile(string $fileKey)

Parameters

string $fileKey

Return Value

string|null

at line 344
bool hasLangFile(string $fileKey)

Parameters

string $fileKey

Return Value

bool

at line 355
bool addLangFile(string $file, string $fileKey = null)

Parameters

string $file
string $fileKey

Return Value

bool

Exceptions

InvalidArgumentException

at line 392
bool hasLangFileData($fileKey)

Parameters

$fileKey

Return Value

bool

at line 405
bool hasLang(string $lang)

Parameters

string $lang

Return Value

bool

at line 414
bool isLang(string $lang)

Parameters

string $lang

Return Value

bool

at line 426
mixed|string __get(string $name)

Allow quick access default file translate by $lang->key, is equals to $lang->tl('key').

Parameters

string $name

Return Value

mixed|string

Exceptions

InvalidArgumentException

at line 431
__isset($name)

Parameters

$name

at line 435
__set($name, $value)

Parameters

$name
$value

at line 447
mixed|string __call(string $name, array $args)

Allow quick access default file translate by $lang->key(), is equals to $lang->tl('key').

Parameters

string $name
array $args

Return Value

mixed|string

Exceptions

InvalidArgumentException

at line 455
string getLang()

Return Value

string

at line 463
setLang(string $lang)

Parameters

string $lang

at line 471
string[] getLangs()

Return Value

string[]

at line 479
setLangs(array $langs)

Parameters

array $langs

at line 487
string getBasePath()

Return Value

string

at line 496
setBasePath(string $path)

Parameters

string $path

Exceptions

InvalidArgumentException

at line 508
Collection getData()

Return Value

Collection

at line 516
array getLangFiles()

Return Value

array

at line 525
setLangFiles(array $langFiles)

Parameters

array $langFiles

Exceptions

InvalidArgumentException

at line 536
string getDefaultFile(bool $full = false)

Parameters

bool $full

Return Value

string

at line 544
string getFallbackLang()

Return Value

string

at line 552
setFallbackLang(string $fallbackLang)

Parameters

string $fallbackLang

at line 560
Collection getFallbackData()

Return Value

Collection

at line 568
string getFormat()

Return Value

string

at line 576
setFormat(string $format)

Parameters

string $format

at line 586
string getSeparator()

Return Value

string

at line 594
setSeparator(string $separator)

Parameters

string $separator

at line 602
array getLoadedFiles()

Return Value

array

at line 610
bool isIgnoreError()

Return Value

bool

at line 618
setIgnoreError(bool $ignoreError)

Parameters

bool $ignoreError

at line 634
Traversable getIterator()

Retrieve an external iterator

Return Value

Traversable An instance of an object implementing Iterator or Traversable

at line 651
boolean offsetExists(mixed $offset)

Whether a offset exists

Parameters

mixed $offset An offset to check for.

Return Value

boolean true on success or false on failure.

<

p> The return value will be casted to boolean if non-boolean was returned.

at line 666
mixed offsetGet(mixed $offset)

Offset to retrieve

Parameters

mixed $offset The offset to retrieve.

Return Value

mixed Can return all value types.

Exceptions

InvalidArgumentException

at line 683
void offsetSet(mixed $offset, mixed $value)

Offset to set

Parameters

mixed $offset The offset to assign the value to.
mixed $value The value to set.

Return Value

void

at line 697
void offsetUnset(mixed $offset)

Offset to unset

Parameters

mixed $offset The offset to unset.

Return Value

void

at line 711
int count()

Count elements of an object

Return Value

int The custom count as an integer.

<

p> The return value is cast to an integer.