Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4126489
I18nInfo.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
I18nInfo.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Wikimedia\Parsoid\NodeData
;
use
Wikimedia\Bcp47Code\Bcp47Code
;
class
I18nInfo
{
public
const
USER_LANG
=
"x-user"
;
public
const
PAGE_LANG
=
"x-page"
;
/**
* Value for the "lang" parameter. Can be one of USER_LANG or PAGE_LANG, or a fixed language
* code (discouraged when USER_LANG or PAGE_LANG could be used instead).
* @var string
*/
public
$lang
;
/**
* Key of the message in localization files
* @var string
*/
public
$key
;
/**
* Ordered list of parameters for the localized message
* @var ?array
*/
public
$params
;
public
function
__construct
(
string
$lang
,
string
$key
,
?
array
$params
=
null
)
{
$this
->
lang
=
$lang
;
$this
->
key
=
$key
;
$this
->
params
=
$params
;
}
/**
* Creates internationalization information for a string or attribute value in the user
* interface language.
* @param string $key
* @param array|null $params
* @return I18nInfo
*/
public
static
function
createInterfaceI18n
(
string
$key
,
?
array
$params
):
I18nInfo
{
return
new
I18nInfo
(
self
::
USER_LANG
,
$key
,
$params
);
}
/**
* Creates internationalization information for a string or attribute value in the page
* content language.
* @param string $key
* @param array|null $params
* @return I18nInfo
*/
public
static
function
createPageContentI18n
(
string
$key
,
?
array
$params
):
I18nInfo
{
return
new
I18nInfo
(
self
::
PAGE_LANG
,
$key
,
$params
);
}
/**
* Creates internationalization information for a string or attribute value in an arbitrary
* language.
* The use of this method is discouraged; use ::createPageContentI18n(...) and
* ::createInterfaceI18n(...) where possible rather than, respectively,
* ::createLangI18n($wgContLang, ...) and ::createLangI18n($wgLang, ...).
* @param Bcp47Code $lang
* @param string $key
* @param array|null $params
* @return I18nInfo
*/
public
static
function
createLangI18n
(
Bcp47Code
$lang
,
string
$key
,
?
array
$params
):
I18nInfo
{
return
new
I18nInfo
(
$lang
->
toBcp47Code
(),
$key
,
$params
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 08:07 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
04/49/680d6d17597d27ef9bb09f4f6ed9
Default Alt Text
I18nInfo.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment