X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=blobdiff_plain;f=includes%2Fspecials%2Fformfields%2FLicenses.php;h=a2f312846274175f37fd2ab2c2b39aa6ff53dc2e;hb=339adab63a1e6016446743f2003d42fbfc1fbace;hp=931cd240a05ef70ada40c5f4af54e467040b08db;hpb=12ff4dec05ff8bb1a1910bf6745155b93e1912b5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/formfields/Licenses.php b/includes/specials/formfields/Licenses.php index 931cd240a0..a2f3128462 100644 --- a/includes/specials/formfields/Licenses.php +++ b/includes/specials/formfields/Licenses.php @@ -57,9 +57,25 @@ class Licenses extends HTMLFormField { * @return string */ protected static function getMessageFromParams( $params ) { - return empty( $params['licenses'] ) - ? wfMessage( 'licenses' )->inContentLanguage()->plain() - : $params['licenses']; + global $wgContLang; + + if ( !empty( $params['licenses'] ) ) { + return $params['licenses']; + } + + // If the licenses page is in $wgForceUIMsgAsContentMsg (which is the case + // on Commons), translations will be in the database, in subpages of this + // message (e.g. MediaWiki:Licenses/) + // If there is no such translation, the result will be '-' (the empty default + // in the i18n files), so we'll need to force it to look up the actual licenses + // in the default site language (= get the translation from MediaWiki:Licenses) + // Also see https://phabricator.wikimedia.org/T3495 + $defaultMsg = wfMessage( 'licenses' )->inContentLanguage(); + if ( !$defaultMsg->exists() || $defaultMsg->plain() === '-' ) { + $defaultMsg = wfMessage( 'licenses' )->inLanguage( $wgContLang ); + } + + return $defaultMsg->plain(); } /**