Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
DocumentationAid.php
1<?php
2declare( strict_types = 1 );
3
4namespace MediaWiki\Extension\Translate\TranslatorInterface\Aid;
5
8use MediaWiki\MediaWikiServices;
9
18 public function getData(): array {
19 global $wgTranslateDocumentationLanguageCode;
20 if ( !$wgTranslateDocumentationLanguageCode ) {
21 throw new TranslationHelperException( 'Message documentation is disabled' );
22 }
23
24 $page = $this->handle->getKey();
25 $ns = $this->handle->getTitle()->getNamespace();
26
27 $info = Utilities::getMessageContent( $page, $wgTranslateDocumentationLanguageCode, $ns ) ?? '';
28
29 return [
30 'language' => MediaWikiServices::getInstance()->getContentLanguage()->getCode(),
31 'value' => $info,
32 'html' => $this->context->getOutput()->parseAsInterface( $info )
33 ];
34 }
35}
Translation aid that provides the message documentation.
getData()
Translation aid class should implement this function.
Translation helpers can throw this exception when they cannot do anything useful with the current mes...
Essentially random collection of helper functions, similar to GlobalFunctions.php.
Definition Utilities.php:31