MessageCatalogue

Catalogue of loaded translation strings for a language

since

2.0.0-alpha

package

Joomla Framework

Methods

__construct

MessageCatalogue constructor.

__construct(string language, array messages = []) : mixed
since

2.0.0-alpha

Arguments

language

stringThe language of the messages in this catalogue

messages

arrayThe messages to seed this catalogue with

Response

mixed

addMessage

Add a message to the catalogue, replacing the key if it already exists

addMessage(string key, string message) : void

Arguments

key

stringThe key identifying the message

message

stringThe message for this key

addMessages

Add messages to the catalogue, replacing any keys which already exist

addMessages(array messages) : void
since

2.0.0-alpha

Arguments

messages

arrayAn associative array containing the messages to add to the catalogue

definesMessage

Check if this catalogue has a message for the given key, ignoring a fallback if defined

definesMessage(string key) : bool
since

2.0.0-alpha

Arguments

key

stringThe key to check

Response

bool

getFallbackCatalogue

Get the fallback for this catalogue if set

getFallbackCatalogue() : \Joomla\Language\MessageCatalogue|null
since

2.0.0-alpha

Response

\Joomla\Language\MessageCatalogue|null

getLanguage

Get the language for this catalogue

getLanguage() : string
since

2.0.0-alpha

Response

string

getMessage

Get the message for a given key

getMessage(string key) : string
since

2.0.0-alpha

Arguments

key

stringThe key to get the message for

Response

stringThe message if one is set otherwise the key

getMessages

Fetch the messages stored in this catalogue

getMessages() : array
since

2.0.0-alpha

Response

array

hasMessage

Check if the catalogue has a message for the given key

hasMessage(string key) : bool
since

2.0.0-alpha

Arguments

key

stringThe key to check

Response

bool

mergeCatalogue

Merge another catalogue into this one

mergeCatalogue(\Joomla\Language\MessageCatalogue messageCatalogue) : void
since

2.0.0-alpha

throws

\LogicException

Arguments

messageCatalogue

\Joomla\Language\MessageCatalogueThe catalogue to merge

setFallbackCatalogue

Set the fallback for this catalogue

setFallbackCatalogue(\Joomla\Language\MessageCatalogue messageCatalogue) : void
since

2.0.0-alpha

Arguments

messageCatalogue

\Joomla\Language\MessageCatalogueThe catalogue to use as the fallback

Properties

fallbackCatalogue

A fallback for this catalogue

since

2.0.0-alpha

Type(s)

\Joomla\Language\MessageCatalogue

language

The language of the messages in this catalogue

since

2.0.0-alpha

Type(s)

string

messages

The messages stored to this catalogue

since

2.0.0-alpha

Type(s)

array