Merge "Handle <nowiki> and other markup consistently in image link/alt options"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index efd98fd..3dc2eeb 100644 (file)
@@ -5258,6 +5258,8 @@ class Parser {
                #  * bottom
                #  * text-bottom
 
+               global $wgMediaInTargetLanguage;
+
                # Protect LanguageConverter markup when splitting into parts
                $parts = StringUtils::delimiterExplode(
                        '-{', '}-', '|', $options, true /* allow nesting */
@@ -5418,6 +5420,9 @@ class Parser {
                        # Use the "caption" for the tooltip text
                        $params['frame']['title'] = $this->stripAltText( $caption, $holders );
                }
+               if ( $wgMediaInTargetLanguage ) {
+                       $params['handler']['targetlang'] = $this->getTargetLanguage()->getCode();
+               }
 
                Hooks::run( 'ParserMakeImageParams', [ $title, $file, &$params, $this ] );
 
@@ -5928,7 +5933,7 @@ class Parser {
        }
 
        private function makeLegacyAnchor( $sectionName ) {
-               $fragmentMode = $this->config->get( 'FragmentMode' );
+               $fragmentMode = $this->siteConfig->get( 'FragmentMode' );
                if ( isset( $fragmentMode[1] ) && $fragmentMode[1] === 'legacy' ) {
                        // ForAttribute() and ForLink() are the same for legacy encoding
                        $id = Sanitizer::escapeIdForAttribute( $sectionName, Sanitizer::ID_FALLBACK );