Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1426206
ReferenceMessageLocalizer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ReferenceMessageLocalizer.php
View Options
<?php
namespace
Cite
;
use
MediaWiki\Language\Language
;
use
MediaWiki\Message\Message
;
use
MessageLocalizer
;
use
Wikimedia\Message\MessageSpecifier
;
/**
* Interface abstracts everything a Cite needs to do with languages.
*
* @license GPL-2.0-or-later
*/
class
ReferenceMessageLocalizer
implements
MessageLocalizer
{
public
function
__construct
(
private
readonly
Language
$language
,
)
{
}
public
function
localizeSeparators
(
string
$number
):
string
{
// Filter to make sure characters are never removed
return
strtr
(
$number
,
array_filter
(
$this
->
language
->
separatorTransformTable
()
?:
[]
)
);
}
/**
* Transliterate numerals, without adding or changing separators.
*/
public
function
localizeDigits
(
string
$number
):
string
{
return
$this
->
language
->
formatNumNoSeparators
(
$number
);
}
/**
* This is the method for getting translated interface messages.
*
* Note that it returns messages coerced to a specific language, the content language
* rather than the UI language.
*
* @see https://www.mediawiki.org/wiki/Manual:Messages_API
* @see Message::__construct
*
* @param string|string[]|MessageSpecifier $key Message key, or array of keys,
* or a MessageSpecifier.
* @param mixed ...$params Normal message parameters
*
* @return Message
*/
public
function
msg
(
$key
,
...
$params
):
Message
{
return
wfMessage
(
$key
,
...
$params
)->
inLanguage
(
$this
->
language
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 12:47 (1 d, 7 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0a/00/14160a537f8a31f4884e709dd1ef
Default Alt Text
ReferenceMessageLocalizer.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment