Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 1.24 KB

language_api.md

File metadata and controls

25 lines (17 loc) · 1.24 KB
description
You can add languages to the system and get information about existing languages via the PHP API.

Language API

You can manage languages configured in the system with PHP API by using LanguageService.

Getting language information

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) =]]

Creating a language

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) =]]