Copied!

LanguageService

LanguageService.php : 15

Language service, used for language operations.

Methods

publiccreateLanguage()

LanguageService.php : 27

Creates the a new Language in the content repository.

public createLanguage(LanguageCreateStruct $languageCreateStruct) : Language

Parameters

Name Type Default value Description
$languageCreateStruct LanguageCreateStruct - -

Return values

Language

Tags
Throws
UnauthorizedException

If user does not have access to content translations

Throws
InvalidArgumentException

if the languageCode already exists

publicdeleteLanguage()

LanguageService.php : 123

Deletes a language from content repository.

public deleteLanguage(Language $language) : void

Parameters

Name Type Default value Description
$language Language - -
Tags
Throws
InvalidArgumentException

if language can not be deleted because it is still assigned to some content / type / (...).

Throws
UnauthorizedException

If user is not allowed to delete a language

publicdisableLanguage()

LanguageService.php : 61

Disables a language.

public disableLanguage(Language $language) : Language

Parameters

Name Type Default value Description
$language Language - -

Return values

Language

Tags
Throws
UnauthorizedException

If user does not have access to content translations

publicenableLanguage()

LanguageService.php : 50

Enables a language.

public enableLanguage(Language $language) : Language

Parameters

Name Type Default value Description
$language Language - -

Return values

Language

Tags
Throws
UnauthorizedException

If user does not have access to content translations

publicgetDefaultLanguageCode()

LanguageService.php : 130

Returns a configured default language code.

public getDefaultLanguageCode() : string

Return values

string

publicloadLanguage()

LanguageService.php : 72

Loads a Language from its language code ($languageCode).

public loadLanguage(string $languageCode) : Language

Parameters

Name Type Default value Description
$languageCode string - -

Return values

Language

Tags
Throws
NotFoundException

if language could not be found

publicloadLanguageById()

LanguageService.php : 90

Loads a Language by its id ($languageId).

public loadLanguageById(int $languageId) : Language

Parameters

Name Type Default value Description
$languageId int - -

Return values

Language

Tags
Throws
NotFoundException

if language could not be found

publicloadLanguageListByCode()

LanguageService.php : 101

Bulk-load Languages by language codes.

public loadLanguageListByCode(array<string|int, string> $languageCodes) : array<string|int, Language>

Note: it does not throw exceptions on load, just ignores erroneous Languages.

Parameters

Name Type Default value Description
$languageCodes array<string|int, string> - -

Return values

array<string|int, Language>

list of Languages with language-code as keys

publicloadLanguageListById()

LanguageService.php : 112

Bulk-load Languages by ids.

public loadLanguageListById(array<string|int, int> $languageIds) : array<string|int, Language>

Note: it does not throw exceptions on load, just ignores erroneous Languages.

Parameters

Name Type Default value Description
$languageIds array<string|int, int> - -

Return values

array<string|int, Language>

list of Languages with id as keys

publicloadLanguages()

LanguageService.php : 79

Loads all Languages.

public loadLanguages() : array<string|int, Language>

Return values

array<string|int, Language>

publicnewLanguageCreateStruct()

LanguageService.php : 137

Instantiates an object to be used for creating languages.

public newLanguageCreateStruct() : LanguageCreateStruct

Return values

LanguageCreateStruct

publicupdateLanguageName()

LanguageService.php : 39

Changes the name of the language in the content repository.

public updateLanguageName(Language $language, string $newName) : Language

Parameters

Name Type Default value Description
$language Language - -
$newName string - -

Return values

Language

Tags
Throws
UnauthorizedException

If user does not have access to content translations