class lang_support

internal  
 

Utility functions for Moodle language strings.

Methods

static lang_string|string
get(string $identifier, mixed $a = null, bool $lazyload = false, string $component = middag_helper::COMPONENT_NAME)

Retrieves a localized string.

static lang_string|string
get_string(string $identifier, string $component = '', mixed $a = null, bool $lazyload = false)

Retrieves a localized string (alias for get).

static lang_string|string
get_string_or_identifier(string $identifier, string $component = '', mixed $a = null, bool $lazyload = false)

Retrieves a localized string if it exists, otherwise returns the identifier.

static bool
string_exists(string $identifier, string $component = middag_helper::COMPONENT_NAME)

Checks if a language string exists in the component.

static string
pluginname()

Retrieves the plugin name from language strings.

Details

at line 43
static lang_string|string get(string $identifier, mixed $a = null, bool $lazyload = false, string $component = middag_helper::COMPONENT_NAME)

Retrieves a localized string.

Parameters

string $identifier

the string identifier

mixed $a

variable to replace in the string

bool $lazyload

whether to return a lang_string object

string $component

Component name

Return Value

lang_string|string

the localized string or object

at line 68
static lang_string|string get_string(string $identifier, string $component = '', mixed $a = null, bool $lazyload = false)

Retrieves a localized string (alias for get).

Parameters

string $identifier

the string identifier

string $component

Component name

mixed $a

variable to replace in the string

bool $lazyload

whether to return a lang_string object

Return Value

lang_string|string

the localized string or object

at line 89
static lang_string|string get_string_or_identifier(string $identifier, string $component = '', mixed $a = null, bool $lazyload = false)

Retrieves a localized string if it exists, otherwise returns the identifier.

Parameters

string $identifier

the string identifier

string $component

Component name

mixed $a

variable to replace in the string

bool $lazyload

whether to return a lang_string object

Return Value

lang_string|string

the localized string or the identifier

at line 112
static bool string_exists(string $identifier, string $component = middag_helper::COMPONENT_NAME)

Checks if a language string exists in the component.

Parameters

string $identifier

Language string identifier

string $component

Component name (default: local_middag)

Return Value

bool

True if string exists, false otherwise

at line 134
static string pluginname()

Retrieves the plugin name from language strings.

Return Value

string

The plugin name