jenkins-bot has submitted this change and it was merged.

Change subject: No language fallback when serializing wbEntity.
......................................................................


No language fallback when serializing wbEntity.

wbEntity should (for now) only contain explicitly defined terms.
If we later decide to include terms derived via language fallback,
such terms should be makred accordingly.

Bug: T76210
Change-Id: Ie00c62d48497c8f75c13df0cad8768c2efb11e22
---
M repo/includes/EntityParserOutputGeneratorFactory.php
1 file changed, 7 insertions(+), 5 deletions(-)

Approvals:
  Aude: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/EntityParserOutputGeneratorFactory.php 
b/repo/includes/EntityParserOutputGeneratorFactory.php
index 1efa6cc..025d410 100644
--- a/repo/includes/EntityParserOutputGeneratorFactory.php
+++ b/repo/includes/EntityParserOutputGeneratorFactory.php
@@ -7,6 +7,7 @@
 use ParserOutput;
 use RequestContext;
 use User;
+use ValueFormatters\ValueFormatter;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\EntityIdParser;
@@ -102,7 +103,7 @@
                return new ParserOutputJsConfigBuilder(
                        $this->entityIdParser,
                        $this->entityTitleLookup,
-                       $this->makeSerializationOptions( $languageCode )
+                       $this->makeJsConfigSerializationOptions( $languageCode )
                );
        }
 
@@ -145,12 +146,13 @@
         *
         * @return SerializationOptions
         */
-       private function makeSerializationOptions( $languageCode ) {
-               $fallbackChain = $this->getLanguageFallbackChain( $languageCode 
);
-               $languageCodes = Utils::getLanguageCodes() + array( 
$languageCode => $fallbackChain );
+       private function makeJsConfigSerializationOptions( $languageCode ) {
+               // NOTE: when serializing the full entity to be stored in the
+               // wbEntity JS config variable, we currently do not want any
+               // language fallback to be applied.
 
                $options = new SerializationOptions();
-               $options->setLanguages( $languageCodes );
+               $options->setOption( ValueFormatter::OPT_LANG, $languageCode );
 
                return $options;
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie00c62d48497c8f75c13df0cad8768c2efb11e22
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: wmf/1.25wmf12c
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to