mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/InputBox
synced 2024-11-15 03:04:52 +00:00
Make InputBoxes cache ones per language
InputBoxes creates HTML which will later be cached (probably). Right now this can lead to strange button labels eg. https://www.wikidata.org/wiki/Wikidata:Requests_for_comment?uselang=qqx&action=purge will cache the qqx of the createarticle button so that all users see it (till it's purged again). To prevent this we set the parser to cache per user language. Change-Id: I69ade88bb43f73404965b7cb63e88b824561d988
This commit is contained in:
parent
efff8a604d
commit
e18b7e6c7b
|
@ -41,6 +41,9 @@ class InputBox {
|
|||
$this->mParser = $parser;
|
||||
// Default value for dir taken from the page language (bug 37018)
|
||||
$this->mDir = $this->mParser->getTargetLanguage()->getDir();
|
||||
// Split caches by language, to make sure visitors do not see a cached
|
||||
// version in a random language (since labels are in the user language)
|
||||
$this->mParser->getOptions()->getUserLangObj();
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
@ -64,8 +67,8 @@ class InputBox {
|
|||
'class' => 'error'
|
||||
),
|
||||
strlen( $this->mType ) > 0
|
||||
? wfMessage( 'inputbox-error-bad-type', $this->mType )->inContentLanguage()->text()
|
||||
: wfMessage( 'inputbox-error-no-type' )->inContentLanguage()->text()
|
||||
? wfMessage( 'inputbox-error-bad-type', $this->mType )->text()
|
||||
: wfMessage( 'inputbox-error-no-type' )->text()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue