ComponentTranslations
View component translations trait
Table of Contents
Properties
- $skipFiles : array<string|int, mixed>
- Skip component option files
Methods
- getComponentLanguages() : array<string|int, mixed>
- Get component languages
- getComponentTranslations() : array<string|int, mixed>
- Get package view components translations
- getTranslationFileName() : string
- Get translation file name
- getTranslationRelativeFileName() : string
- Get translation relative file name path
- hasLanguage() : bool
- Return true if component have language
- readTranlationProperty() : mixed
- Get translation property value
- readTranslation() : array<string|int, mixed>|false
- Read language translation
- resolveTranslationFileName() : string
- Resolve translation file name
- saveTranslation() : bool
- Save translation
- setTranslationProperty() : array<string|int, mixed>
- Set translation property value
Properties
$skipFiles
Skip component option files
private
array<string|int, mixed>
$skipFiles
= ['component.json', 'page.json']
Methods
getComponentLanguages()
Get component languages
public
getComponentLanguages(array<string|int, mixed> $componentFiles) : array<string|int, mixed>
Parameters
- $componentFiles : array<string|int, mixed>
Return values
array<string|int, mixed>getComponentTranslations()
Get package view components translations
public
getComponentTranslations(string $componentName[, string $type = 'components' ]) : array<string|int, mixed>
Parameters
- $componentName : string
- $type : string = 'components'
Return values
array<string|int, mixed>getTranslationFileName()
Get translation file name
public
getTranslationFileName(string $componentName, string $language[, string $type = 'components' ]) : string
Parameters
- $componentName : string
- $language : string
- $type : string = 'components'
Return values
stringgetTranslationRelativeFileName()
Get translation relative file name path
public
getTranslationRelativeFileName(string $componentName, string $language[, string $type = 'components' ]) : string
Parameters
- $componentName : string
- $language : string
- $type : string = 'components'
Return values
stringhasLanguage()
Return true if component have language
public
hasLanguage(array<string|int, mixed> $translations, string $language) : bool
Parameters
- $translations : array<string|int, mixed>
- $language : string
Return values
boolreadTranlationProperty()
Get translation property value
public
readTranlationProperty(array<string|int, mixed>|string $data, string $key[, string $separator = '_' ][, string|null $language = null ][, string $type = 'components' ]) : mixed
Parameters
- $data : array<string|int, mixed>|string
- $key : string
- $separator : string = '_'
- $language : string|null = null
- $type : string = 'components'
readTranslation()
Read language translation
public
readTranslation(string $componentName, string $language[, string $type = 'components' ]) : array<string|int, mixed>|false
Parameters
- $componentName : string
- $language : string
- $type : string = 'components'
Return values
array<string|int, mixed>|falseresolveTranslationFileName()
Resolve translation file name
public
resolveTranslationFileName(string $path, string $language) : string
Parameters
- $path : string
- $language : string
Return values
stringsaveTranslation()
Save translation
public
saveTranslation(array<string|int, mixed> $data, string $componentName, string $language[, string $type = 'components' ]) : bool
Parameters
- $data : array<string|int, mixed>
- $componentName : string
- $language : string
- $type : string = 'components'
Return values
boolsetTranslationProperty()
Set translation property value
public
setTranslationProperty(array<string|int, mixed> $data, string $key, mixed $value[, string $separator = '_' ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $key : string
- $value : mixed
- $separator : string = '_'