Jens Ohlig has uploaded a new change for review.

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


Change subject: (#46125) Lua function label(id) that takes an ID and returns 
the label in the language of the client Wiki
......................................................................

(#46125) Lua function label(id) that takes an ID and returns the label in the 
language of the client Wiki

Change-Id: Iecc7cf51ced432d25fb161f3639f791029979f7e
---
M client/resources/mw.wikibase.lua
1 file changed, 5 insertions(+), 0 deletions(-)


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

diff --git a/client/resources/mw.wikibase.lua b/client/resources/mw.wikibase.lua
index 533fb4d..5d7c481 100644
--- a/client/resources/mw.wikibase.lua
+++ b/client/resources/mw.wikibase.lua
@@ -28,6 +28,7 @@
 function wikibase.setupInterface()
   local title  = require('mw.title')
   local site = require('mw.site')
+  local language = require('mw.language')
   local php = mw_interface
   mw_interface = nil
   wikibase.getEntity = function()
@@ -36,6 +37,10 @@
     entity = php.getEntity(id)
     return entity
   end
+  wikibase.label = function(id)
+    code = language.getContentLanguage().code
+    return php.getEntity(id).labels[code].value
+  end
   mw = mw or {}
   mw.wikibase = wikibase
   package.loaded['mw.wikibase'] = wikibase

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

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

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

Reply via email to