الفرق بين المراجعتين لصفحة: «وحدة:Wikidata2»

تم حذف المحتوى تمت إضافة المحتوى
لا ملخص تعديل
لا ملخص تعديل
سطر 823:
end
function p.descriptionIn(framelangcode,id)
 
local lan = langcode or 'ar'
function p.descriptionIn(frame)
local langcode = frame.args[1]
local id = frame.args[2] -- "id" must be nil, as access to other Wikidata objects is disabled in Mediawiki configuration
-- return descriptions of a Wikidata entity in the given language or the default language of this Wikipedia site
local entity = mw.wikibase.getEntityObject(id)
if entity
and entity.descriptions
and entity.descriptions ~= [''..lan..'']
returnand entity.descriptions[langcode or 'ar'..lan..''].value
then
if langcode =='ar'
then
iflocal lang = entity.descriptions['ar'].value == entity.descriptions[lan..'en'].value
if lang['language'] == lan then
then return nil
else return entity.descriptions['ar'..lan..''].value
else return nil end
else
return entity.descriptions[langcode or 'ar'].value
end
return ''
end
end
 
function p.labelIn(framelangcode,id)
local langcodelan = frame.args[1]langcode or 'ar'
local id = frame.args[2] -- "id" must be nil, as access to other Wikidata objects is disabled in Mediawiki configuration
-- return labels of a Wikidata entity in the given language or the default language of this Wikipedia site
local entity = mw.wikibase.getEntityObject(id)
if entity.labels
and entity.labels ~= ''
returnand entity.labels[langcode or 'ar'].value.lan..'']
then
and entity.labels[''..lan..''].value
if langcode =='ar'
then
iflocal lang = entity.labels['ar'].value == entity.labels[lan..'en'].value
if lang['language'] == lan then
then return nil
else return entity.labels['ar'..lan..''].value
else return nil end
else
return entity.labels[langcode or 'ar'].value
end
end
return ''
 
end
function p.descriptionIn(frame)
local langcode = frame.args[1]
local id = frame.args[2] -- "id" must be nil, as access to other Wikidata objects is disabled in Mediawiki configuration
 
return descriptionIn( langcode ,id )
end
 
function p.labelIn(frame)
local langcode = frame.args[1]
local id = frame.args[2] -- "id" must be nil, as access to other Wikidata objects is disabled in Mediawiki configuration
 
return labelIn( langcode ,id )
end