Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
HTMLPurifier_Language Class Reference

Public Member Functions

 __construct ($config, $context)
 
 formatMessage ($key, $args=array())
 Formats a localised message with passed parameters.
 
 getErrorName ($int)
 Retrieves a localised error name.
 
 getMessage ($key)
 Retrieves a localised message.
 
 listify ($array)
 Converts an array list into a string readable representation.
 
 load ()
 Loads language object with necessary info from factory cache.
 

Public Attributes

 $_loaded = false
 Has the language object been loaded yet? @type bool.
 
 $code = 'en'
 ISO 639 language code of language.
 
 $error = false
 True if no message file was found for this language, so English is being used instead.
 
 $errorNames = array()
 Array of localizable error codes.
 
 $fallback = false
 Fallback language code.
 
 $messages = array()
 Array of localizable messages.
 

Protected Attributes

 $config
 @type HTMLPurifier_Config
 
 $context
 @type HTMLPurifier_Context
 

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_Language::__construct ( $config,
$context )
Parameters
HTMLPurifier_Config$config
HTMLPurifier_Context$context

Member Function Documentation

◆ formatMessage()

HTMLPurifier_Language::formatMessage ( $key,
$args = array() )

Formats a localised message with passed parameters.

Parameters
string$keystring identifier of message
array$argsParameters to substitute in
Return values
stringlocalised message
Todo
Implement conditionals? Right now, some messages make reference to line numbers, but those aren't always available

◆ getErrorName()

HTMLPurifier_Language::getErrorName ( $int)

Retrieves a localised error name.

Parameters
int$interror number, corresponding to PHP's error reporting
Return values
stringlocalised message

◆ getMessage()

HTMLPurifier_Language::getMessage ( $key)

Retrieves a localised message.

Parameters
string$keystring identifier of message
Return values
stringlocalised message

◆ listify()

HTMLPurifier_Language::listify ( $array)

Converts an array list into a string readable representation.

Parameters
array$array
Return values
string

◆ load()

HTMLPurifier_Language::load ( )

Loads language object with necessary info from factory cache.

Note
This is a lazy loader

Member Data Documentation

◆ $_loaded

HTMLPurifier_Language::$_loaded = false

Has the language object been loaded yet? @type bool.

Todo
Make it private, fix usage in HTMLPurifier_LanguageTest

◆ $code

HTMLPurifier_Language::$code = 'en'

ISO 639 language code of language.

Prefers shortest possible version. @type string

◆ $error

HTMLPurifier_Language::$error = false

True if no message file was found for this language, so English is being used instead.

Check this if you'd like to notify the user that they've used a non-supported language. @type bool

◆ $errorNames

HTMLPurifier_Language::$errorNames = array()

Array of localizable error codes.

@type array

◆ $fallback

HTMLPurifier_Language::$fallback = false

Fallback language code.

@type bool|string

◆ $messages

HTMLPurifier_Language::$messages = array()

Array of localizable messages.

@type array


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