22 $group = $this->handle->getGroup();
27 $fileFormat = $group->getFFS();
32 $cache = $group->getMessageGroupCache( $group->getSourceLanguage() );
33 if ( !$cache->exists() ) {
37 $extra = $cache->getExtra();
38 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
39 $messageKey = $contLang->lcfirst( $this->handle->getKey() );
40 $messageKey = str_replace(
' ',
'_', $messageKey );
42 $help = $extra[
'TEMPLATE'][$messageKey][
'comments'] ??
null;
44 throw new TranslationHelperException(
"No comments found for key '$messageKey'" );
47 $conf = $group->getConfiguration();
48 if ( isset( $conf[
'BASIC'][
'codeBrowser'] ) ) {
49 $pattern = $conf[
'BASIC'][
'codeBrowser'];
50 $pattern = str_replace(
'%FILE%',
'\1', $pattern );
51 $pattern = str_replace(
'%LINE%',
'\2', $pattern );
52 $pattern =
"[$pattern \\1:\\2]";
58 foreach ( $help as $type => $lines ) {
59 if ( $type ===
':' ) {
61 foreach ( $lines as $line ) {
62 $files .=
' ' . preg_replace(
'/([^ :]+):(\d+)/', $pattern, $line );
64 $out .=
"<nowiki>#:</nowiki> $files<br />";
66 foreach ( $lines as $line ) {
67 $out .=
"<nowiki>#$type</nowiki> $line<br />";
72 $html = $this->context->getOutput()->parseAsContent( $out );
75 'language' => $contLang->getCode(),