MediaWiki fundraising/REL1_35
MessageUtils Class Reference

Convenience methods for translating and localizing interface messages. More...

Static Public Member Functions

static getCountrySpecificMessage ( $key, $country, $language, $params=[])
 Retrieves and translates a country-specific message, or the default if no country-specific version exists.
 
static languageSpecificFallback ( $language='en', $msg_keys=[], $params=[])
 languageSpecificFallback - returns the text of the first existing message in the requested language.
 
static makeSafe ( $string)
 This function limits the possible characters passed as template keys and values to letters, numbers, hyphens and underscores.
 

Detailed Description

Convenience methods for translating and localizing interface messages.

Definition at line 6 of file MessageUtils.php.

Member Function Documentation

◆ getCountrySpecificMessage()

static MessageUtils::getCountrySpecificMessage ( $key,
$country,
$language,
$params = [] )
static

Retrieves and translates a country-specific message, or the default if no country-specific version exists.

Parameters
string$key
string$country
string$language
array$paramsextra message parameters
Returns
string Localized message

Definition at line 53 of file MessageUtils.php.

References languageSpecificFallback().

Referenced by Gateway_Form_Mustache\getErrors(), Gateway_Form_Mustache\l10n(), and GatewayPage\setClientVariables().

◆ languageSpecificFallback()

static MessageUtils::languageSpecificFallback ( $language = 'en',
$msg_keys = [],
$params = [] )
static

languageSpecificFallback - returns the text of the first existing message in the requested language.

If no messages are found in that language, the function returns the first existing fallback message.

Parameters
string$languagethe code of the requested language
array$msg_keys
array$paramsextra message parameters
Exceptions
InvalidArgumentException
Returns
string the text of the first existing message

Definition at line 19 of file MessageUtils.php.

Referenced by getCountrySpecificMessage().

◆ makeSafe()

static MessageUtils::makeSafe ( $string)
static

This function limits the possible characters passed as template keys and values to letters, numbers, hyphens and underscores.

The function also performs standard escaping of the passed values.

Parameters
string$stringThe unsafe string to escape and check for invalid characters
Returns
string Sanitized version of input

Definition at line 67 of file MessageUtils.php.

Referenced by DonationData\setAppeal().


The documentation for this class was generated from the following file: