Make redlink tooltip be content language to stop cache pollution.
authorBrian Wolff <bawolff+wn@gmail.com>
Sun, 13 Dec 2015 08:42:00 +0000 (03:42 -0500)
committerBrian Wolff <bawolff+wn@gmail.com>
Tue, 19 Jan 2016 21:51:58 +0000 (21:51 +0000)
Redlink tooltips end up in parser cache!

This is not ideal, as ideally it would be in the page's language,
not the content language and it would be user language for things
outside of pages, but that's not easy to do the way the code is
structured, and this is much better than the alternative.

Other possibilities include:
* Splitting parser cache (Previously been reverted, and doesn't
seem worth it given the feature in question)
* Post-processing step after parsing (Really complicated. Doesn't
seem worth it)

Bug: T34686
Change-Id: Id632f8ef59d1c762aed1867a708c569cbff5f0dd

includes/Linker.php

index 0dd4c47..3ba472b 100644 (file)
@@ -346,7 +346,10 @@ class Linker {
                } elseif ( in_array( 'known', $options ) ) {
                        $defaults['title'] = $target->getPrefixedText();
                } else {
-                       $defaults['title'] = wfMessage( 'red-link-title', $target->getPrefixedText() )->text();
+                       // This ends up in parser cache!
+                       $defaults['title'] = wfMessage( 'red-link-title', $target->getPrefixedText() )
+                               ->inContentLanguage()
+                               ->text();
                }
 
                # Finally, merge the custom attribs with the default ones, and iterate