Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1427910
LazyLocalizationContext.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
849 B
Referenced Files
None
Subscribers
None
LazyLocalizationContext.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
*/
namespace
MediaWiki\Language
;
/**
* Wrapper for injecting a LocalizationContext with lazy initialization.
*
* @since 1.42
* @ingroup Language
*/
class
LazyLocalizationContext
implements
LocalizationContext
{
/** @var callable */
private
$instantiator
;
private
?
LocalizationContext
$context
=
null
;
public
function
__construct
(
callable
$instantiator
)
{
$this
->
instantiator
=
$instantiator
;
}
private
function
resolve
():
LocalizationContext
{
if
(
!
$this
->
context
)
{
$this
->
context
=
(
$this
->
instantiator
)();
}
return
$this
->
context
;
}
/** @inheritDoc */
public
function
getLanguageCode
()
{
return
$this
->
resolve
()->
getLanguageCode
();
}
/** @inheritDoc */
public
function
msg
(
$key
,
...
$params
)
{
return
$this
->
resolve
()->
msg
(
$key
,
...
$params
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 15:19 (15 h, 20 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ae/df/7383bb1b963a8c9c8fc2596e4747
Default Alt Text
LazyLocalizationContext.php (849 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment