Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1426082
MessageTable.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
MessageTable.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Extension\Translate\TranslatorInterface
;
use
MediaWiki\Context\ContextSource
;
use
MediaWiki\Context\IContextSource
;
use
MediaWiki\Extension\Translate\Services
;
use
MediaWiki\Html\Html
;
use
MediaWiki\MediaWikiServices
;
use
MessageGroup
;
/**
* Display messages for translation & review
* @author Niklas Laxström
* @license GPL-2.0-or-later
*/
class
MessageTable
extends
ContextSource
{
protected
MessageGroup
$group
;
protected
string
$language
;
public
function
__construct
(
IContextSource
$context
,
MessageGroup
$group
,
string
$language
)
{
$this
->
setContext
(
$context
);
$this
->
group
=
$group
;
if
(
MediaWikiServices
::
getInstance
()->
getLanguageNameUtils
()->
isKnownLanguageTag
(
$language
)
)
{
$this
->
language
=
$language
;
}
else
{
$this
->
language
=
$context
->
getLanguage
()->
getCode
();
}
}
public
function
fullTable
():
string
{
$modules
=
[];
Services
::
getInstance
()->
getHookRunner
()->
onTranslateBeforeAddModules
(
$modules
);
$this
->
getOutput
()->
addModules
(
$modules
);
$languageFactory
=
MediaWikiServices
::
getInstance
()->
getLanguageFactory
();
$sourceLang
=
$languageFactory
->
getLanguage
(
$this
->
group
->
getSourceLanguage
()
);
$targetLang
=
$languageFactory
->
getLanguage
(
$this
->
language
);
$batchSize
=
100
;
$list
=
Html
::
element
(
'div'
,
[
'class'
=>
'row tux-messagelist'
,
'data-grouptype'
=>
get_class
(
$this
->
group
),
'data-sourcelangcode'
=>
$sourceLang
->
getCode
(),
'data-sourcelangdir'
=>
$sourceLang
->
getDir
(),
'data-targetlangcode'
=>
$targetLang
->
getCode
(),
'data-targetlangdir'
=>
$targetLang
->
getDir
(),
]
);
$groupId
=
htmlspecialchars
(
$this
->
group
->
getId
()
);
$msg
=
$this
->
msg
(
'tux-messagetable-loading-messages'
)
->
numParams
(
$batchSize
)
->
escaped
();
$loader
=
<<<
HTML
<
div
class
=
"tux-messagetable-loader hide"
data
-
messagegroup
=
"$groupId"
data
-
pagesize
=
"$batchSize"
>
<
span
class
=
"tux-loading-indicator"
></
span
>
<
div
class
=
"tux-messagetable-loader-info"
>
$msg
</
div
>
</
div
>
HTML
;
$hideOwn
=
$this
->
msg
(
'tux-editor-proofreading-hide-own-translations'
)->
escaped
();
$clearTranslated
=
$this
->
msg
(
'tux-editor-clear-translated'
)->
escaped
();
$modeTranslate
=
$this
->
msg
(
'tux-editor-translate-mode'
)->
escaped
();
$modePage
=
$this
->
msg
(
'tux-editor-page-mode'
)->
escaped
();
$modeProofread
=
$this
->
msg
(
'tux-editor-proofreading-mode'
)->
escaped
();
$actionbar
=
<<<
HTML
<
div
class
=
"tux-action-bar hide row"
>
<
div
class
=
"three columns tux-message-list-statsbar"
data
-
messagegroup
=
"$groupId"
></
div
>
<
div
class
=
"three columns text-center"
>
<
button
class
=
"toggle button tux-proofread-own-translations-button hide"
>
$hideOwn
</
button
>
<
button
class
=
"toggle button tux-editor-clear-translated hide"
>
$clearTranslated
</
button
>
</
div
>
<
div
class
=
"six columns tux-view-switcher text-center"
>
<
button
class
=
"toggle down translate-mode-button"
>
$modeTranslate
</
button
><
button
class
=
"toggle down page-mode-button"
>
$modePage
</
button
><
button
class
=
"toggle hide proofread-mode-button"
>
$modeProofread
</
button
>
</
div
>
</
div
>
HTML
;
// Actual message table is fetched and rendered at client side. This just provides
// the loader and action bar.
return
$list
.
$loader
.
$actionbar
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 12:32 (1 d, 4 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9f/ec/1e02b0374942dfbc457406b68d2e
Default Alt Text
MessageTable.php (3 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment