Aude has uploaded a new change for review.

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

Change subject: Apply LanguageFallback (variants) for getLabel in lua
......................................................................

Apply LanguageFallback (variants) for getLabel in lua

we had this before we changed to use the label lookup.

maybe we also want a method to request labels without
resolving fallback or something else? regardless of
whatever / however else we want, i think we should
keep getLabel behavior consistent with what it was before.

Change-Id: I07e698b9fec99c612f0d52fc337396360b765b66
---
M client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
1 file changed, 10 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/22/178422/1

diff --git a/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php 
b/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
index bd4de1e..bf95c3f 100644
--- a/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
+++ b/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
@@ -4,8 +4,9 @@
 use Wikibase\Client\Usage\ParserOutputUsageAccumulator;
 use Wikibase\Client\WikibaseClient;
 use Wikibase\DataModel\Entity\EntityIdParsingException;
+use Wikibase\LanguageFallbackChainFactory;
 use Wikibase\Lib\Store\EntityRetrievingTermLookup;
-use Wikibase\Lib\Store\LanguageLabelLookup;
+use Wikibase\Lib\Store\LanguageFallbackLabelLookup;
 use Wikibase\Utils;
 
 /**
@@ -40,9 +41,15 @@
                $wikibaseClient = WikibaseClient::getDefaultInstance();
 
                $entityLookup = $wikibaseClient->getStore()->getEntityLookup();
-               $labelLookup = new LanguageLabelLookup(
+
+               $fallbackChain = 
$wikibaseClient->getLanguageFallbackChainFactory()->newFromLanguage(
+                       $language,
+                       LanguageFallbackChainFactory::FALLBACK_SELF | 
LanguageFallbackChainFactory::FALLBACK_VARIANTS
+               );
+
+               $labelLookup = new LanguageFallbackLabelLookup(
                        new EntityRetrievingTermLookup( $entityLookup ),
-                       $wgContLang->getCode()
+                       $fallbackChain
                );
 
                return new WikibaseLuaBindings(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07e698b9fec99c612f0d52fc337396360b765b66
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>

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

Reply via email to