From 13c703e93d3738f7f9a3d11c327a2567f2be82ef Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Fri, 16 Dec 2016 20:57:06 +0100 Subject: [PATCH] Change linking Special:PageLanguage on action=info Change from linking of description to extra link behind the data. Also reorder the code and language name to match the order on Special:PageLanguage Change-Id: I859df5d04c5d937fba55c309034a0350574b5af7 --- includes/actions/InfoAction.php | 23 +++++++++++------------ languages/i18n/en.json | 1 + languages/i18n/qqq.json | 1 + 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 6cafaa5278..5fb83b3d18 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -261,23 +261,22 @@ class InfoAction extends FormlessAction { // Language in which the page content is (supposed to be) written $pageLang = $title->getPageLanguage()->getCode(); + $pageLangHtml = $pageLang . ' - ' . + Language::fetchLanguageName( $pageLang, $lang->getCode() ); + // Link to Special:PageLanguage with pre-filled page title if user has permissions if ( $config->get( 'PageLanguageUseDB' ) && $title->userCan( 'pagelang', $user ) ) { - // Link to Special:PageLanguage with pre-filled page title if user has permissions - $titleObj = SpecialPage::getTitleFor( 'PageLanguage', $title->getPrefixedText() ); - $langDisp = $linkRenderer->makeLink( - $titleObj, - $this->msg( 'pageinfo-language' )->text() - ); - } else { - // Display just the message - $langDisp = $this->msg( 'pageinfo-language' )->escaped(); + $pageLangHtml .= ' ' . $this->msg( 'parentheses' )->rawParams( $linkRenderer->makeLink( + SpecialPage::getTitleValueFor( 'PageLanguage', $title->getPrefixedText() ), + $this->msg( 'pageinfo-language-change' )->text() + ) )->escaped(); } - $pageInfo['header-basic'][] = [ $langDisp, - Language::fetchLanguageName( $pageLang, $lang->getCode() ) - . ' ' . $this->msg( 'parentheses', $pageLang )->escaped() ]; + $pageInfo['header-basic'][] = [ + $this->msg( 'pageinfo-language' )->escaped(), + $pageLangHtml + ]; // Content model of the page $modelHtml = htmlspecialchars( ContentHandler::getLocalizedName( $title->getContentModel() ) ); diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 882357f8c0..bd1d780515 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -2834,6 +2834,7 @@ "pageinfo-length": "Page length (in bytes)", "pageinfo-article-id": "Page ID", "pageinfo-language": "Page content language", + "pageinfo-language-change": "change", "pageinfo-content-model": "Page content model", "pageinfo-content-model-change": "change", "pageinfo-robot-policy": "Indexing by robots", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index d292c7264f..dcc3d3ad98 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -3018,6 +3018,7 @@ "pageinfo-length": "The length of the page, in bytes.", "pageinfo-article-id": "The numeric identifier of the page.\n{{Identical|Page ID}}", "pageinfo-language": "Language in which the page content is written.", + "pageinfo-language-change": "Link text for a link to Special:PageLanguage. The link will be wrapped in parenthesis.\n{{Identical|Change}}", "pageinfo-content-model": "The model in which the page content is written.\n\nUsed as label at [{{fullurl:Main Page|action=info}} action=info]. Followed by one of the following messages:\n* {{msg-mw|Content-model-wikitext}}\n* {{msg-mw|Content-model-javascript}}\n* {{msg-mw|Content-model-css}}\n* {{msg-mw|Content-model-text}}", "pageinfo-content-model-change": "Link text for a link to Special:ChangeContentModel. The link will be wrapped in parenthesis.\n{{Identical|Change}}", "pageinfo-robot-policy": "The search engine status of the page.\n\nUsed as label. Followed by any one of the following messages:\n*{{msg-mw|Pageinfo-robot-index}}\n*{{msg-mw|Pageinfo-robot-noindex}}", -- 2.20.1