description |
---|
You can add languages to the system and get information about existing languages via the PHP API. |
You can manage languages configured in the system with PHP API by using LanguageService
.
To get a list of all languages in the system use LanguageService::loadLanguages
:
[[= include_file('code_samples/api/public_php_api/src/Command/AddLanguageCommand.php', 37, 42) =]]
To create a new language, you need to create a LanguageCreateStruct
and provide it with the language code and language name.
Then, use LanguageService::createLanguage
and pass the LanguageCreateStruct
to it:
[[= include_file('code_samples/api/public_php_api/src/Command/AddLanguageCommand.php', 43, 47) =]]