Class

eZ\Publish\Core\Repository\LanguageService

class LanguageService implements LanguageService

Language service, used for language operations.

Methods

__construct(Repository $repository, Handler $languageHandler, array $settings = array())

Setups service with reference to repository object that created it & corresponding handler.

Language createLanguage(LanguageCreateStruct $languageCreateStruct)

Creates the a new Language in the content repository.

Language updateLanguageName(Language $language, string $newName)

Changes the name of the language in the content repository.

Language enableLanguage(Language $language)

Enables a language.

Language disableLanguage(Language $language)

Disables a language.

Language loadLanguage(string $languageCode)

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

Language[] loadLanguages()

Loads all Languages.

Language loadLanguageById(mixed $languageId)

Loads a Language by its id ($languageId).

deleteLanguage(Language $language)

Deletes a language from content repository.

string getDefaultLanguageCode()

Returns a configured default language code.

string[] getPrioritizedLanguageCodeList()

Returns a configured list of prioritized languageCodes.

LanguageCreateStruct newLanguageCreateStruct()

Instantiates an object to be used for creating languages.

Details

at line 52
public __construct(Repository $repository, Handler $languageHandler, array $settings = array())

Setups service with reference to repository object that created it & corresponding handler.

Parameters

Repository $repository
Handler $languageHandler
array $settings

at line 72
public Language createLanguage(LanguageCreateStruct $languageCreateStruct)

Creates the a new Language in the content repository.

Parameters

LanguageCreateStruct $languageCreateStruct

Return Value

Language

Exceptions

UnauthorizedException If user does not have access to content translations
InvalidArgumentException if the languageCode already exists

at line 130
public Language updateLanguageName(Language $language, string $newName)

Changes the name of the language in the content repository.

Parameters

Language $language
string $newName

Return Value

Language

Exceptions

InvalidArgumentException if languageCode argument is not string
UnauthorizedException If user does not have access to content translations

at line 172
public Language enableLanguage(Language $language)

Enables a language.

Parameters

Language $language

Return Value

Language

Exceptions

UnauthorizedException If user does not have access to content translations

at line 210
public Language disableLanguage(Language $language)

Disables a language.

Parameters

Language $language

Return Value

Language

Exceptions

UnauthorizedException If user does not have access to content translations

at line 250
public Language loadLanguage(string $languageCode)

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

Parameters

string $languageCode

Return Value

Language

Exceptions

InvalidArgumentException if languageCode argument is not string
NotFoundException if language could not be found

at line 266
public Language[] loadLanguages()

Loads all Languages.

Return Value

Language[]

at line 287
public Language loadLanguageById(mixed $languageId)

Loads a Language by its id ($languageId).

Parameters

mixed $languageId

Return Value

Language

Exceptions

NotFoundException if language could not be found

at line 304
public deleteLanguage(Language $language)

Deletes a language from content repository.

Parameters

Language $language

Exceptions

InvalidArgumentException if language can not be deleted because it is still assigned to some content / type / (...).
UnauthorizedException If user does not have access to content translations

at line 330
public string getDefaultLanguageCode()

Returns a configured default language code.

Return Value

string

at line 341
public string[] getPrioritizedLanguageCodeList()

Returns a configured list of prioritized languageCodes.

Return Value

string[]

at line 351
public LanguageCreateStruct newLanguageCreateStruct()

Instantiates an object to be used for creating languages.

Return Value

LanguageCreateStruct