class LanguageManager implements BasicEntityManagerInterface

Class LanguageManager is injected as alligator.language_manager service. LanguageManager handles the logic for managed entity.

Properties

protected LanguageRepository $languageRepository
protected LanguageEventContainer $eventContainer
protected array $allLanguages

Methods

__construct(LanguageRepository $languageRepository, LanguageEventContainer $eventContainer)

LanguageManager constructor.

array
getAllLanguages()

Find all languages

getLanguageById(int $id)

Find language for provided id

bool
setDefaultLanguage(int $id)

Set default language(to database, cache and parameters.yml)

string
getDefaultLanguageLocale()

Retrieve locale for default language

saveLanguage(Language $language)

Upload translation file and save new language Supported file types are: excel and yml

editLanguage(Language $language)

Update existing language

bool
removeLanguage(int $languageId)

Remove language

array
getAvailableLanguages()

Find all available languages

getReference(int $id)

Retrieve reference for language

mixed
setLanguagesToCache()

Set all available languages to cache

signalUpdateMessageTranslation(string $key, string $value, int $languageId)

Update database translation(for messages domain)

string
prepareLanguageForDownload(string $localeToDownload)

Prepare translations for download - merge all translations in one files

Details

at line 45
__construct(LanguageRepository $languageRepository, LanguageEventContainer $eventContainer)

LanguageManager constructor.

Parameters

LanguageRepository $languageRepository
LanguageEventContainer $eventContainer

at line 56
array getAllLanguages()

Find all languages

Return Value

array

at line 75
Language getLanguageById(int $id)

Find language for provided id

Parameters

int $id

Return Value

Language

Exceptions

NoResultException
NonUniqueResultException

at line 89
bool setDefaultLanguage(int $id)

Set default language(to database, cache and parameters.yml)

Parameters

int $id

Return Value

bool

Exceptions

Exception

at line 109
string getDefaultLanguageLocale()

Retrieve locale for default language

Return Value

string

at line 132
Language saveLanguage(Language $language)

Upload translation file and save new language Supported file types are: excel and yml

Parameters

Language $language

Return Value

Language

Exceptions

PHPExcel_Exception
PHPExcel_Reader_Exception

at line 154
Language editLanguage(Language $language)

Update existing language

Parameters

Language $language

Return Value

Language

at line 177
bool removeLanguage(int $languageId)

Remove language

Parameters

int $languageId

Return Value

bool

at line 196
array getAvailableLanguages()

Find all available languages

Return Value

array

at line 213
Language getReference(int $id)

Retrieve reference for language

Parameters

int $id

Return Value

Language

at line 223
mixed setLanguagesToCache()

Set all available languages to cache

Return Value

mixed

at line 239
signalUpdateMessageTranslation(string $key, string $value, int $languageId)

Update database translation(for messages domain)

Parameters

string $key
string $value
int $languageId

Exceptions

DBALException

at line 251
string prepareLanguageForDownload(string $localeToDownload)

Prepare translations for download - merge all translations in one files

Parameters

string $localeToDownload

Return Value

string