Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MessageHandle Class Reference

Class for pointing to messages, like Title class is for titles. More...

Public Member Functions

 __construct (LinkTarget $title)
 
 isMessageNamespace ()
 Check if this handle is in a message namespace.
 
 figureMessage ()
 Recommended to use getCode and getKey instead.
 
 getKey ()
 Returns the identified or guessed message key.
 
 getCode ()
 Returns the language code.
 
 getEffectiveLanguage ()
 Return the Language object for the assumed language of the content, which might be different from the subpage code (qqq, no subpage).
 
 isDoc ()
 Determine whether the current handle is for message documentation.
 
 isPageTranslation ()
 Determine whether the current handle is for page translation feature.
 
 getGroupIds ()
 Returns all message group ids this message belongs to.
 
 getGroup ()
 Get the primary MessageGroup this message belongs to.
 
 isValid ()
 Checks if the handle corresponds to a known message.
 
 getTitle ()
 Get the original title.
 
 getTitleForLanguage ( $code)
 Get the original title.
 
 getTitleForBase ()
 Get the title for the page base.
 
 isFuzzy ()
 Check if a title is marked as fuzzy.
 
 getInternalKey ()
 This returns the key that can be used for showMessage parameter for Special:Translate for regular message groups.
 

Static Public Member Functions

static hasFuzzyString ( $text)
 Check if a string contains the fuzzy string.
 
static makeFuzzyString (string $text)
 Check if a string has fuzzy string and if not, add it.
 

Protected Attributes

 $title
 
 $key
 
 $code
 
 $groupIds
 

Detailed Description

Class for pointing to messages, like Title class is for titles.

Since
2011-03-13

Definition at line 20 of file MessageHandle.php.

Constructor & Destructor Documentation

◆ __construct()

MessageHandle::__construct ( LinkTarget $title)

Definition at line 30 of file MessageHandle.php.

Member Function Documentation

◆ figureMessage()

MessageHandle::figureMessage ( )

Recommended to use getCode and getKey instead.

Returns
string[] Array of the message key and the language code

Definition at line 49 of file MessageHandle.php.

◆ getCode()

MessageHandle::getCode ( )

Returns the language code.

For language codeless source messages will return empty string.

Returns
string

Definition at line 83 of file MessageHandle.php.

◆ getEffectiveLanguage()

MessageHandle::getEffectiveLanguage ( )

Return the Language object for the assumed language of the content, which might be different from the subpage code (qqq, no subpage).

Returns
Language
Since
2016-01

Definition at line 95 of file MessageHandle.php.

◆ getGroup()

MessageHandle::getGroup ( )

Get the primary MessageGroup this message belongs to.

You should check first that the handle is valid.

Returns
MessageGroup|null

Definition at line 146 of file MessageHandle.php.

◆ getGroupIds()

MessageHandle::getGroupIds ( )

Returns all message group ids this message belongs to.

The primary message group id is always the first one. If the handle does not correspond to any message, the returned array is empty.

Returns
string[]

Definition at line 133 of file MessageHandle.php.

◆ getInternalKey()

MessageHandle::getInternalKey ( )

This returns the key that can be used for showMessage parameter for Special:Translate for regular message groups.

It is not possible to automatically determine this key from the title alone.

Returns
string
Since
2017.10

Definition at line 270 of file MessageHandle.php.

◆ getKey()

MessageHandle::getKey ( )

Returns the identified or guessed message key.

Returns
string

Definition at line 72 of file MessageHandle.php.

◆ getTitle()

MessageHandle::getTitle ( )

Get the original title.

Returns
Title

Definition at line 197 of file MessageHandle.php.

◆ getTitleForBase()

MessageHandle::getTitleForBase ( )

Get the title for the page base.

Returns
Title
Since
2014.04

Definition at line 219 of file MessageHandle.php.

◆ getTitleForLanguage()

MessageHandle::getTitleForLanguage ( $code)

Get the original title.

Parameters
string$codeLanguage code.
Returns
Title
Since
2014.04

Definition at line 207 of file MessageHandle.php.

◆ hasFuzzyString()

static MessageHandle::hasFuzzyString ( $text)
static

Check if a string contains the fuzzy string.

Parameters
string$textArbitrary text
Returns
bool If string contains fuzzy string.

Definition at line 232 of file MessageHandle.php.

◆ isDoc()

MessageHandle::isDoc ( )

Determine whether the current handle is for message documentation.

Returns
bool

Definition at line 111 of file MessageHandle.php.

◆ isFuzzy()

MessageHandle::isFuzzy ( )

Check if a title is marked as fuzzy.

Returns
bool If title is marked fuzzy.

Definition at line 245 of file MessageHandle.php.

◆ isMessageNamespace()

MessageHandle::isMessageNamespace ( )

Check if this handle is in a message namespace.

Returns
bool

Definition at line 38 of file MessageHandle.php.

◆ isPageTranslation()

MessageHandle::isPageTranslation ( )

Determine whether the current handle is for page translation feature.

This does not consider whether the handle corresponds to any message.

Returns
bool

Definition at line 122 of file MessageHandle.php.

◆ isValid()

MessageHandle::isValid ( )

Checks if the handle corresponds to a known message.

Since
2011-03-16
Returns
bool

Definition at line 160 of file MessageHandle.php.

◆ makeFuzzyString()

static MessageHandle::makeFuzzyString ( string $text)
static

Check if a string has fuzzy string and if not, add it.

Definition at line 237 of file MessageHandle.php.

Member Data Documentation

◆ $code

MessageHandle::$code
protected

Definition at line 26 of file MessageHandle.php.

◆ $groupIds

MessageHandle::$groupIds
protected

Definition at line 28 of file MessageHandle.php.

◆ $key

MessageHandle::$key
protected

Definition at line 24 of file MessageHandle.php.

◆ $title

MessageHandle::$title
protected

Definition at line 22 of file MessageHandle.php.


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