Skip to content

HTMLPurifier_Language

Represents a language and defines localizable string formatting and other functions, as well as the localized messages for HTML Purifier.

  • Full name: \HTMLPurifier_Language

Properties

code

ISO 639 language code of language. Prefers shortest possible version.

public $code

fallback

Fallback language code.

public $fallback

messages

Array of localizable messages.

public $messages

errorNames

Array of localizable error codes.

public $errorNames

error

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.

public $error

_loaded

Has the language object been loaded yet?

public $_loaded

config

protected $config

context

protected $context

Methods

__construct

public __construct(\HTMLPurifier_Config $config, \HTMLPurifier_Context $context): mixed

Parameters:

Parameter Type Description
$config \HTMLPurifier_Config
$context \HTMLPurifier_Context

load

Loads language object with necessary info from factory cache

public load(): mixed

getMessage

Retrieves a localised message.

public getMessage(string $key): string

Parameters:

Parameter Type Description
$key string string identifier of message

Return Value:

localised message


getErrorName

Retrieves a localised error name.

public getErrorName(int $int): string

Parameters:

Parameter Type Description
$int int error number, corresponding to PHP's error reporting

Return Value:

localised message


listify

Converts an array list into a string readable representation

public listify(array $array): string

Parameters:

Parameter Type Description
$array array

formatMessage

Formats a localised message with passed parameters

public formatMessage(string $key, array $args = array()): string

Parameters:

Parameter Type Description
$key string string identifier of message
$args array Parameters to substitute in

Return Value:

localised message



Automatically generated on 2025-03-18