trait ComponentTranslations

View component translations trait

Methods

array
getComponentTranslations(string $componentName, string $type = 'components')

Get package view components translations

array|false
readTranslation(string $componentName, string|null $language, string $type = 'components')

Read language translation

string
getTranslationRelativeFileName(string $componentName, string|null $language, string $type = 'components')

Get translation relative file name path

string
getTranslationFileName(string $componentName, string|null $language, string $type = 'components')

Get translation file name

bool
saveTranslation(array $data, string $componentName, string|null $language, string $type = 'components')

Save translation

mixed
readTranlationProperty(array|string $data, string $key, string $separator = '_', string|null $language = null, string $type = 'components')

Get translation property value

array
setTranslationProperty(array $data, string $key, mixed $value, string $separator = '_')

Set translation property value

string
resolveTranslationFileName(string $path, string|null $language)

Resolve translation file name

bool
hasLanguage(array $translations, string|null $language)

Return true if component have language

array
getComponentLanguages(array $componentFiles)

Get component languages

Details

at line 39
array getComponentTranslations(string $componentName, string $type = 'components')

Get package view components translations

Parameters

string $componentName
string $type

Return Value

array

at line 67
array|false readTranslation(string $componentName, string|null $language, string $type = 'components')

Read language translation

Parameters

string $componentName
string|null $language
string $type

Return Value

array|false

at line 82
string getTranslationRelativeFileName(string $componentName, string|null $language, string $type = 'components')

Get translation relative file name path

Parameters

string $componentName
string|null $language
string $type

Return Value

string

at line 97
string getTranslationFileName(string $componentName, string|null $language, string $type = 'components')

Get translation file name

Parameters

string $componentName
string|null $language
string $type

Return Value

string

at line 119
bool saveTranslation(array $data, string $componentName, string|null $language, string $type = 'components')

Save translation

Parameters

array $data
string $componentName
string|null $language
string $type

Return Value

bool

at line 145
mixed readTranlationProperty(array|string $data, string $key, string $separator = '_', string|null $language = null, string $type = 'components')

Get translation property value

Parameters

array|string $data
string $key
string $separator
string|null $language
string $type

Return Value

mixed

at line 166
array setTranslationProperty(array $data, string $key, mixed $value, string $separator = '_')

Set translation property value

Parameters

array $data
string $key
mixed $value
string $separator

Return Value

array

at line 178
string resolveTranslationFileName(string $path, string|null $language)

Resolve translation file name

Parameters

string $path
string|null $language

Return Value

string

at line 193
bool hasLanguage(array $translations, string|null $language)

Return true if component have language

Parameters

array $translations
string|null $language

Return Value

bool

at line 206
array getComponentLanguages(array $componentFiles)

Get component languages

Parameters

array $componentFiles

Return Value

array