* $wgDBClusterTimeout has been removed.
* $wgProxyKey has been removed. It is no longer used by MediaWiki core.
Ensure $wgSecretKey is set in LocalSettings.php.
+* $wgExtraInterlanguageLinkPrefixes is a new configuration variable that
+ contains an array of interwiki prefixes that should be treated as language
+ prefixes (i.e. turned into interlanguage links when $wgInterwikiMagic is set
+ to true).
=== New features in 1.24 ===
* Added a new hook, "WhatLinksHereProps", to allow extensions to annotate
*/
$wgHideInterlanguageLinks = false;
+/**
+ * List of additional interwiki prefixes that should be treated as
+ * interlanguage links (i.e. placed in the sidebar).
+ * Notes:
+ * - This will not do anything unless the prefixes are defined in the interwiki
+ * map.
+ * - The display text for these custom interlanguage links will be fetched from
+ * the system message "interlanguage-link-xyz" where xyz is the prefix in
+ * this array.
+ * - A friendly name for each site, used for tooltip text, may optionally be
+ * placed in the system message "interlanguage-link-sitename-xyz" where xyz is
+ * the prefix in this array.
+ */
+$wgExtraInterlanguageLinkPrefixes = array();
+
/**
* List of language names or overrides for default names in Names.php
*/
$ilLangName = Language::fetchLanguageName( $ilInterwikiCode );
if ( strval( $ilLangName ) === '' ) {
- $ilLangName = $languageLinkText;
+ $ilDisplayTextMsg = wfMessage( "interlanguage-link-$ilInterwikiCode" );
+ if ( !$ilDisplayTextMsg->isDisabled() ) {
+ // Use custom MW message for the display text
+ $ilLangName = $ilDisplayTextMsg->text();
+ } else {
+ // Last resort: fallback to the language link target
+ $ilLangName = $languageLinkText;
+ }
} else {
+ // Use the language autonym as display text
$ilLangName = $this->formatLanguageName( $ilLangName );
}
);
$languageLinkTitleText = $languageLinkTitle->getText();
- if ( $languageLinkTitleText === '' ) {
+ if ( $ilLangLocalName === '' ) {
+ $ilFriendlySiteName = wfMessage( "interlanguage-link-sitename-$ilInterwikiCode" );
+ if ( !$ilFriendlySiteName->isDisabled() ) {
+ if ( $languageLinkTitleText === '' ) {
+ $ilTitle = wfMessage(
+ 'interlanguage-link-title-nonlangonly',
+ $ilFriendlySiteName->text()
+ )->text();
+ } else {
+ $ilTitle = wfMessage(
+ 'interlanguage-link-title-nonlang',
+ $languageLinkTitleText,
+ $ilFriendlySiteName->text()
+ )->text();
+ }
+ } else {
+ // we have nothing friendly to put in the title, so fall back to
+ // displaying the interlanguage link itself in the title text
+ // (similar to what is done in page content)
+ $ilTitle = $languageLinkTitle->getInterwiki() .
+ ":$languageLinkTitleText";
+ }
+ } elseif ( $languageLinkTitleText === '' ) {
$ilTitle = wfMessage(
'interlanguage-link-title-langonly',
$ilLangLocalName
$langNames = Language::fetchLanguageNames( $langCode );
$getPrefixes = Interwiki::getAllPrefixes( $local );
+ $extraLangPrefixes = $this->getConfig()->get( 'ExtraInterlanguageLinkPrefixes' );
$data = array();
foreach ( $getPrefixes as $row ) {
if ( $row['iw_trans'] == '1' ) {
$val['trans'] = '';
}
+
if ( isset( $langNames[$prefix] ) ) {
$val['language'] = $langNames[$prefix];
}
+ if ( in_array( $prefix, $extraLangPrefixes ) ) {
+ $val['extralanglink'] = '';
+
+ $linktext = wfMessage( "interlanguage-link-$prefix" );
+ if ( !$linktext->isDisabled() ) {
+ $val['linktext'] = $linktext->text();
+ }
+
+ $sitename = wfMessage( "interlanguage-link-sitename-$prefix" );
+ if ( !$sitename->isDisabled() ) {
+ $val['sitename'] = $sitename->text();
+ }
+ }
+
$val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT );
if (substr( $row['iw_url'], 0, 2) == '//') {
$val['protorel'] = '';
}
public function getCacheMode( $params ) {
+ // Messages for $wgExtraInterlanguageLinkPrefixes depend on user language
+ if (
+ count( $this->getConfig()->get( 'ExtraInterlanguageLinkPrefixes' ) ) &&
+ !is_null( $params['prop'] ) &&
+ in_array( 'interwikimap', $params['prop'] )
+ ) {
+ return 'anon-public-user-private';
+ }
+
return 'public';
}
* @private
*/
function replaceInternalLinks2( &$s ) {
+ global $wgExtraInterlanguageLinkPrefixes;
wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__ . '-setup' );
if ( $noforce ) {
# Interwikis
wfProfileIn( __METHOD__ . "-interwiki" );
- if ( $iw && $this->mOptions->getInterwikiMagic()
- && $nottalk && Language::fetchLanguageName( $iw, null, 'mw' )
+ if (
+ $iw && $this->mOptions->getInterwikiMagic() && $nottalk && (
+ Language::fetchLanguageName( $iw, null, 'mw' ) ||
+ in_array( $iw, $wgExtraInterlanguageLinkPrefixes )
+ )
) {
- // XXX: the above check prevents links to sites with identifiers that are not language codes
-
# Bug 24502: filter duplicates
if ( !isset( $this->mLangLinkLanguages[$iw] ) ) {
$this->mLangLinkLanguages[$iw] = true;
"tooltip-summary": "Enter a short summary",
"interlanguage-link-title": "$1 – $2",
"interlanguage-link-title-langonly": "$1",
+ "interlanguage-link-title-nonlang": "$1 – $2",
+ "interlanguage-link-title-nonlangonly": "$1",
"common.css": "/* CSS placed here will be applied to all skins */",
"monobook.css": "/* CSS placed here will affect users of the MonoBook skin */",
"vector.css": "/* CSS placed here will affect users of the Vector skin */",
"tooltip-summary": "Used as tooltip for Summary input box in Editor page.\n\nSee also:\n* {{msg-mw|Summary}}\n* {{msg-mw|Accesskey-summary}}\n* {{msg-mw|Tooltip-summary}}",
"interlanguage-link-title": "{{Optional}}\nFormat of a sidebar interwiki link tooltip. Parameters:\n* $1 - page name in the target wiki\n* $2 - target wiki language autonym",
"interlanguage-link-title-langonly": "{{ignored}}Interlanguage link title. Parameters: $1 replaced with a language name.",
+ "interlanguage-link-title-nonlang": "{{Optional}}\nFormat of a tooltip for a sidebar interwiki link that points to a specific project. Parameters:\n* $1 - page name in the target wiki\n* $2 - name of the target wiki (probably not a language name)",
+ "interlanguage-link-title-nonlangonly": "{{ignored}}Interlanguage link title. Parameters: $1 replaced with name of the target wiki (probably not a language name).",
"common.css": "{{optional}}\nCSS applied to all users.",
"monobook.css": "{{optional}}\nCSS applied to users using Monobook skin.",
"vector.css": "{{optional}}",