Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1426031
ContentLanguage.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
807 B
Referenced Files
None
Subscribers
None
ContentLanguage.php
View Options
<?php
namespace
Cite\ResourceLoader
;
use
MediaWiki\MediaWikiServices
;
use
MediaWiki\ResourceLoader
as
RL
;
/**
* Callback to deliver language data for the content language, if different than the interface language.
*
* @copyright 2024 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
* @license MIT
*/
class
ContentLanguage
{
public
static
function
makeScript
(
RL\Context
$context
):
string
{
$contentLang
=
MediaWikiServices
::
getInstance
()->
getContentLanguage
();
$contentLangCode
=
$contentLang
->
getCode
();
$interfaceLangCode
=
$context
->
getLanguage
();
if
(
$contentLangCode
===
$interfaceLangCode
)
{
return
''
;
}
return
'mw.language.setData('
.
$context
->
encodeJson
(
$contentLangCode
)
.
','
.
$context
->
encodeJson
(
$contentLang
->
getJsData
()
)
.
');'
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 12:27 (1 d, 5 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2e/56/cc4b1ca343c1f976562945bef604
Default Alt Text
ContentLanguage.php (807 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment