interface translator_interface

Interface for translation services.

Decouples the framework from Moodle's get_string() global.

Methods

string
trans(string $identifier, string|null $component = null, mixed $args = null)

Translate a string identifier.

bool
has(string $identifier, string|null $component = null)

Check if a translation exists.

Details

at line 37
string trans(string $identifier, string|null $component = null, mixed $args = null)

Translate a string identifier.

Parameters

string $identifier

The string key

string|null $component

The component (plugin) name

mixed $args

Arguments to inject into the string

Return Value

string

The translated string

at line 47
bool has(string $identifier, string|null $component = null)

Check if a translation exists.

Parameters

string $identifier
string|null $component

Return Value

bool