aude added a subscriber: aude. aude added a comment. I took a look at the lua module that is ultimately used here.
https://www.wikidata.org/wiki/Module:Wikidata It uses mw.wikibase.getEntityObject to load the entire entity and then get just the label, afaik in just the content language of Wikidata. In this case, we are also dealing with access to arbitrary items, which is expensive. It would be better if the module used the mw.wikibase.label convenience when possible. It uses a term lookup (wb_terms table) to get individual labels without loading the entire entity, so is less expensive and can be done more times on a page. in https://www.wikidata.org/wiki/User:Aude/menu_challenge2, using a copy of the module, https://www.wikidata.org/wiki/Module:Wikidata_test, I tried the following code and (although somewhat ugly) it seems to work better including in other languages than English. function p._getLabel(entity, lang, default) local label if lang == defaultlang then label = mw.wikibase.label(entity) if not label then return defaultlabel(entity, lang, default) end return label end if not entity then return nil end if type(entity) ~= 'table' then entity = p.getEntity(entity) end if (not entity) or (not entity.labels) then return entity--defaultlabel(entity, lang, default) end for i, lg in pairs(fb.fblist(lang or defaultlang)) do if entity.labels[lg] then return entity.labels[lg].value end end return defaultlabel(entity, lang, default) end if mw.wikibase.label() also took a 'lang' param, then perhaps it could always and be the only thing used in p._getLabel TASK DETAIL https://phabricator.wikimedia.org/T99120 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: aude Cc: aude, Ijon, Aklapper, Wikidata-bugs, Jackmcbarn _______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
