Aude has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232826

Change subject: Set target language in ParserOptions when calling getUserLangObj
......................................................................

Set target language in ParserOptions when calling getUserLangObj

getUserLangObj sets the userlang parser option, which causes
the ParserCache to be split by user language.

Without setting target language, then getTargetLanguage will
return the content language usually, which may be different than
the language used for parsing and caching.

Change-Id: If3d06842ef9c59838fa911c41b7f9602b8cbaa4a
---
M includes/parser/ParserOptions.php
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/26/232826/1

diff --git a/includes/parser/ParserOptions.php 
b/includes/parser/ParserOptions.php
index e6e0593..9072330 100644
--- a/includes/parser/ParserOptions.php
+++ b/includes/parser/ParserOptions.php
@@ -412,11 +412,20 @@
         * @since 1.19
         */
        public function getUserLangObj() {
-               $this->optionUsed( 'userlang' );
+               $this->setUserLanguageOptions();
+
                return $this->mUserLang;
        }
 
        /**
+        * Set user language as target language and record option.
+        */
+       private function setUserLanguageOptions() {
+               $this->optionUsed( 'userlang' );
+               $this->setTargetLanguage( $this->mUserLang );
+       }
+
+       /**
         * Same as getUserLangObj() but returns a string instead.
         *
         * @return string Language code

-- 
To view, visit https://gerrit.wikimedia.org/r/232826
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If3d06842ef9c59838fa911c41b7f9602b8cbaa4a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aude <aude.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to