55 $this->outputHeader();
57 $out = $this->getOutput();
58 $out->addModuleStyles(
'ext.translate.specialpages.styles' );
62 if ( $this->including() ) {
63 $title = Title::newFromText( $par );
65 $out->addWikiMsg(
'translate-translations-including-no-param' );
76 $request = $this->getRequest();
77 $message = $request->getText(
'message' );
78 $namespace = $request->getInt(
'namespace', NS_MAIN );
80 if ( $message !==
'' ) {
81 $title = Title::newFromText( $message, $namespace );
83 $title = Title::newFromText( $par, $namespace );
87 'Help:Extension:Translate/Statistics_and_reporting#Translations_in_all_languages'
91 $title = Title::makeTitle( NS_MEDIAWIKI,
'' );
95 $out->addHTML(
'<br />' );
109 $options[ $text ] = $index;
117 'label-message' =>
'translate-translations-messagename',
119 'default' => $title->getText(),
123 'name' =>
'namespace',
125 'label-message' =>
'translate-translations-project',
126 'options' => $options,
127 'default' => $title->getNamespace(),
131 $context =
new DerivativeContext( $this->getContext() );
132 $context->setTitle( $this->getPageTitle() );
134 HTMLForm::factory(
'ooui', $formDescriptor, $context )
136 ->setSubmitTextMsg(
'allpagessubmit' )
137 ->setWrapperLegendMsg(
'translate-translations-fieldset-title' )
139 ->displayForm(
false );
166 $namespace = $title->getNamespace();
167 $message = $handle->getKey();
169 if ( !$handle->isValid() ) {
170 $this->getOutput()->addWikiMsg(
'translate-translations-no-message', $title->getPrefixedText() );
175 $dbr = wfGetDB( DB_REPLICA );
177 $res = $dbr->select(
'page',
178 [
'page_namespace',
'page_title' ],
180 'page_namespace' => $namespace,
181 'page_title ' . $dbr->buildLike(
"$message/", $dbr->anyString() ),
184 [
'ORDER BY' =>
'page_title', ]
187 if ( !$res->numRows() ) {
188 $this->getOutput()->addWikiMsg(
189 'translate-translations-no-message',
190 $title->getPrefixedText()
195 $this->getOutput()->addWikiMsg(
196 'translate-translations-count',
197 $this->getLanguage()->formatNum( $res->numRows() )
204 foreach ( $res as $s ) {
205 $titles[] = $s->page_title;
208 $pageInfo = TranslateUtils::getContents( $titles, $namespace );
210 $tableheader = Xml::openElement(
'table', [
211 'class' =>
'mw-sp-translate-table sortable wikitable'
214 $tableheader .= Xml::openElement(
'tr' );
215 $tableheader .= Xml::element(
'th',
null, $this->msg(
'allmessagesname' )->text() );
216 $tableheader .= Xml::element(
'th',
null, $this->msg(
'allmessagescurrent' )->text() );
217 $tableheader .= Xml::closeElement(
'tr' );
222 $historyText =
' <sup>' .
223 $this->msg(
'translate-translations-history-short' )->escaped() .
225 $separator = $this->msg(
'word-separator' )->plain();
228 foreach ( $res as $s ) {
229 $key = $s->page_title;
230 $tTitle = Title::makeTitle( $s->page_namespace, $key );
233 $code = $tHandle->getCode();
235 $text = TranslateUtils::getLanguageName( $code, $this->getLanguage()->getCode() );
237 $text .= $this->msg(
'parentheses' )->params( $code )->plain();
238 $tools[
'edit'] = Html::element(
240 [
'href' => TranslateUtils::getEditorUrl( $tHandle ) ],
244 $tools[
'history'] = $this->getLinkRenderer()->makeLink(
246 new HtmlArmor( $historyText ),
248 'title' => $this->msg(
'history-title', $tTitle->getPrefixedDBkey() )->text()
250 [
'action' =>
'history' ]
254 if ( MessageHandle::hasFuzzyString( $pageInfo[$key][0] ) || $tHandle->isFuzzy() ) {
255 $class =
'mw-sp-translate-fuzzy';
258 $languageAttributes = [];
259 if ( $this->languageNameUtils->isKnownLanguageTag( $code ) ) {
260 $language = $tHandle->getEffectiveLanguage();
261 $languageAttributes = [
262 'lang' => $language->getHtmlCode(),
263 'dir' => $language->getDir(),
269 $leftColumn = $tools[
'history'] . $tools[
'edit'];
270 $out .= Xml::tags(
'tr', [
'class' => $class ],
271 Xml::tags(
'td',
null, $leftColumn ) .
272 Xml::tags(
'td', $languageAttributes, $formattedContent )
276 $out .= Xml::closeElement(
'table' );
277 $this->getOutput()->addHTML( $out );