Copied!

LanguageLoader

LanguageLoader.php : 21
Read-only
Final

Loads the languages given to MCP tools by code, failing with one message for every tool.

Tags
Experimental

Methods

public__construct()

LanguageLoader.php : 23
public __construct(LanguageService $languageService)

Parameters

Name Type Default value Description
$languageService LanguageService - -

publicgetDefaultLanguageCode()

LanguageLoader.php : 91

Code of the default language of the current SiteAccess, the first of its configured languages.

public getDefaultLanguageCode() : string

Return values

string

publicload()

LanguageLoader.php : 32
public load(string $languageCode[, string|null $argumentPath = null ]) : Language

Parameters

Name Type Default value Description
$languageCode string - -
$argumentPath string|null null

Path of the tool argument holding the code, e.g. "input.names", named in the message.

Return values

Language

Tags
Throws
ToolCallException

if there is no language with exactly the given code

publicloadEnabled()

LanguageLoader.php : 71
public loadEnabled(string $languageCode[, string|null $argumentPath = null ]) : Language

Parameters

Name Type Default value Description
$languageCode string - -
$argumentPath string|null null

Path of the tool argument holding the code, e.g. "languageCode", named in the message.

Return values

Language

Tags
Throws
ToolCallException

if there is no language with exactly the given code, or it is disabled