Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5956236
I18nTag.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
I18nTag.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Wikimedia\Parsoid\ParserTests
;
use
Wikimedia\Parsoid\DOM\DocumentFragment
;
use
Wikimedia\Parsoid\Ext\ExtensionModule
;
use
Wikimedia\Parsoid\Ext\ExtensionTagHandler
;
use
Wikimedia\Parsoid\Ext\ParsoidExtensionAPI
;
class
I18nTag
extends
ExtensionTagHandler
implements
ExtensionModule
{
/** @inheritDoc */
public
function
sourceToDom
(
ParsoidExtensionAPI
$extApi
,
string
$content
,
array
$args
):
DocumentFragment
{
$tag
=
$extApi
->
extTag
;
if
(
$tag
->
getName
()
===
'i18ntag'
)
{
return
$extApi
->
createPageContentI18nFragment
(
$content
,
null
);
}
else
{
$frag
=
$extApi
->
getTopLevelDoc
()->
createDocumentFragment
();
$span
=
$extApi
->
getTopLevelDoc
()->
createElement
(
'span'
);
$frag
->
appendChild
(
$span
);
$span
->
appendChild
(
$extApi
->
getTopLevelDoc
()->
createTextNode
(
$content
)
);
$extApi
->
addInterfaceI18nAttribute
(
$span
,
'message'
,
$args
[
0
]->
v
,
null
);
return
$frag
;
}
}
/** @inheritDoc */
public
function
getConfig
():
array
{
return
[
'name'
=>
'I18nTag'
,
'tags'
=>
[
[
'name'
=>
'i18ntag'
,
'handler'
=>
self
::
class
],
[
'name'
=>
'i18nattr'
,
'handler'
=>
self
::
class
],
],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 04:17 (3 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e3/80/c2cc4536486a8f2e9e7d6d250d43
Default Alt Text
I18nTag.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment